I have this code that I’m using for my NEA and I have no idea what’s wrong with it
import time
usernames = ["a","b","c"]
passwords = ["1","2","3"]
index = 0
tries = 0
print("Welcome to The Dice Game")
while 1:
print("Enter A to log in or enter B to sign up:")
qw = input().upper()
if qw == "A"or "B":
break
else:
print("Please enter either A to go in or B to sign up")
if qw == "A":
while 1:
print("Please enter your username:")
user1 = input()
index = usernames.index(user1)
print("Please enter your password:")
passw1 = input()
if pass1 == passwords[index]:
pass1 == passwords[index]
print("Player 1 logged in")
break
else:
print("Incorrect")
tries = 1 + tries
if tries == 3:
print("You have entered the username/password incorrect too many times")
print ("You have been locked out for 10 minutes")
time.sleep(600)
if qw == "B":
while 1:
signu = input("Please enter your new username:\t")
usernames.append(signu)
signp = input("Please enter your new password:\t")
passwords.append(signp)
signpc = input("Confirm your password:\t")
if signp != signpc:
print("Passwords don't match, try again")
if signp == signpc:
print("Account created")
print("Now, please sign in")
break
while 1:
print("Please enter your username:")
plr1u = input()
index = usernames.index(user1)
print("Please enter your password:")
plr1p = input()
if pass1 == passwords[index]:
pass1 == passwords[index]
break
else:
print("Incorrect")
tries = 1 + tries
if tries == 3:
print("You have entered the username/password incorrect too many times")
print ("You have been locked out for 10 minutes")
time.sleep(600)
print("Welcome")
The problem is on these lines:
while 1:
print("Enter A to log in or enter B to sign up:")
qw = input().upper()
if qw == "A"or "B":
break
else:
print("Please enter either A to go in or B to sign up")
It completely ignores the else and breaks out.
Help is much appreciated