Solution: PIN verification
Completion requirements
1 2 3 4 5 |
while True: # endless loop pin = input("Enter PIN: ") if pin == "1234": # PIN ok -> discontinue loop break print("PIN ok") |

For advanced programmers:
1 2 3 4 5 6 7 8 9 10 11 12 | def login(code): # definition of function for i in range(3): # counting loop (i=0; i<=2; i=i+1) pin = input("Enter PIN: ") if pin == code: # PIN okay return 0 else: return 1 # PIN wrong if login("1234") == 0: # call of function and check of return value print("PIN ok") else: print("Card has been retracted.") |

Last modified: Monday, 13 March 2023, 8:07 AM