Algorithm:
Start
Declare a variable timeTries=0
while timeTries<3 do
Read PIN
Set timeTries to timeTries+1
if PIN="1234" then
Display "Correct"
Exit while
if timeTries=3:
Display "Account locked"
Stop
Python code:
timeTries=0
while timeTries<3:
PIN = input("Enter PIN: ")
timeTries+=1
if PIN=="1234":
print("Correct")
break
if timeTries==3:
print("Account locked")
Comments
Leave a comment