0
while True:
    look = input("Key : ")
    if look == "ksvbd956dmew1":

But instead of that and having a bunch of elifs can I do like

while True:
    look = input("Key : ")
    if look == "ksvbd956dmew1", "Otherpassword", "Otherpassword":

Then if the user types one of those passwords it lets them in. I wasn't sure what this was called as I am new to python so I couldn't search it up Hopefully someone could help me here :)

Hex
  • 17
  • 5
  • 2
    here is a hint, try searching for what the `in` keyword means in python – gold_cy Feb 18 '21 at 20:04
  • Does this answer your question? [Compare to multiple values in an if statement](https://stackoverflow.com/questions/29372848/compare-to-multiple-values-in-an-if-statement) – Gino Mempin Feb 19 '21 at 00:08

2 Answers2

0
while True:
    look = input("Key : ")
    if look in ("ksvbd956dmew1", "Otherpassword", "Otherpassword"):
        ...
sarartur
  • 1,178
  • 1
  • 4
  • 13
0

Try this,

passwordList = ("ksvbd956dmew1", "Otherpassword", "Otherpassword")
password = input("Please enter password : ")
while True:
    try:
            if password in passwordList:
                print("Password is Correct")
                break
            else:
                raise Exception

    except:
            print("Password is wrong")
            password = input("Please enter password : ")

   
Nott
  • 303
  • 1
  • 8