What should I be using when I want the following program to, after 2 wrong attempts and one (last) correct attempt, not to lock the account?
I am using the following code for a program that asks the user for a password, if the password is correct it accepts the password, if not says "try again" and if there are 3 attempts it says account is locked, but my problem is that even if there are two wrong attempts and one correct attempt, it'll still say "account is locked". What should I be doing differently?
count = 0
while True:
password = input("Password: ")
count += 1
if count == 3:
print("account locked")
break
else:
if password == 'blue':
print("password accepted")
break
else:
print("wrong password, try again")