Python - 20
Python - 20: Mini Project - Password Checker
Let's build a simple password checker using conditions, input, and loops.
👀 Show Example Solution
secret_code = "admin"
tries = 2
while tries > 0:
code = input(
"Enter secret code (" + str(tries) + " tries left): "
)
if code == secret_code:
print("Welcome!")
break
else:
tries = tries - 1
print("Incorrect code")
print("Tries left:")
print(tries)
if tries == 0:
print("Locked Out!")