I have written a program that serves the starting basis for a login menu. It should only allow two inputs; "1" or "2". If they enter 1, they continue as an existing user, but if they enter 2 they continue as a new user. I have a while loop to prevent the user from inputting anything besides these two values.
Why does the code only allow the user to input a "1" to continue the code, but not the "2". I've looked online, but I haven't seen the way people would code or in a while loop. Could anyone make the necessary adjustments to the or so that it works? Thanks.
Edit: Best response by "bastelflp".
#Program menu
YESorNo = input("""
[---------------------------------]
Welcome to the program!
[---------------------------------]
Are you an existing user?
1. [YES]
2. [NO]
-----------------------------------
Type [1] for "YES" or [2] for "NO".
""")
while YESorNo.strip() != ("1" or "2"):
YESorNo = input("""
[---------------------------------]
Welcome to the program!
[---------------------------------]
Are you an existing user?
1. [YES]
2. [NO]
-----------------------------------
Type [1] for "YES" or [2] for "NO".
""")
if YESorNo == "1":
print("Welcome back!")
elif YESorNo == "2":
print("Welcome!")