-5
C1 = ("NeQua")
C2 = ("ImKol")
C3 = ("YoTri")
C3 = ("RoDen")
C4 = ("NaThe")
C5 = ("ReWes")
C6 = ("BrFre")
C7 = ("KaDat")
C8 = ("ViRil")
C9 = ("TrGeo")
C10 = ("DaWay")
C11 = ("CaAma")
C12 = ("ArRes")
C13 = ("BeVic")
C14 = ("MaFre")
C15 = ("AnMer")
C16 = ("SaBro")
C17 = ("PoLig")
C18 = ("HeZbe")
C19 = ("GiLop")
C20 = ("DeTur")
C21 = ("LaKin")
C23 = ("LoLew")
C24 = ("NyRed")

the_ID = input("Please enter your client ID")

if the_ID == 'C1' or 'C2' or 'C3' or 'C4' or 'C5' or 'C6' or 'C7' or 'C8' or 'C9' or 'C10' or 'C12' or 'C13' or 'C14' or 'C15' or 'C16' or 'C17' or 'C18' or 'C19' or 'C20' or 'C21' or 'C22' or 'C23' or 'C24':
    print ("Access Granted")
else:
    print ("Access Denied")

So if your ID is one of them you get the access but otherwise you don't. E.g. If write KaDat it will say access granted because it's in C7.

But if I write gibirish like gsubivdse it will say access denied because its not in any of the variables.

No matter what I type I keep getting access granted. What's wrong with my code?

Yes im a noob at programing :( nvm i got it to work now with a few changes.

gautam singh
  • 11
  • 1
  • 2

1 Answers1

1

This is broken enough I have to say. You compare the_ID with the string 'C1' instead of the value of C1. You should also look up how the or works.

At minimum I would write something like the_ID in :

[C1, C2, C3]
Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Csene
  • 69
  • 4