Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
One possible program:
correct = "2468"
attempts_left = 3
while attempts_left > 0:
pin = input("Enter PIN: ")
if pin == correct:
print("Welcome")
break
attempts_left -= 1
if attempts_left > 0:
print("Wrong. Tries left:", attempts_left)
else:
print("Card locked")