0

I've been trying this python code and it asks for the password even if the names are different. Can anyone help me out?

name = "" while True: print("who are you?") name=input() if name == "Joe"or"joe": print("what is the password?") else: continue password=input() if password == "swordfish": break print("access granted")

30th Sep 2018, 12:41 PM
Ajai Kannan. K
Ajai Kannan. K - avatar
4 ответов
+ 2
the 'if' statement in line 5 should be: if name == "Joe" or name == "joe":
30th Sep 2018, 12:47 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
You can also use: if name in ["Joe", "joe"]:
30th Sep 2018, 12:48 PM
Ulisses Cruz
Ulisses Cruz - avatar
+ 1
you're welcome
30th Sep 2018, 12:58 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
it worked! thank you!!!
30th Sep 2018, 12:56 PM
Ajai Kannan. K
Ajai Kannan. K - avatar