Python

Solution - Control Flow

PIN Security System

Solution

Here is our solution. Remember, we can all come to different solutions. If it works, and is relatively simply built, then you’ve successfully written an efficient and successful program.

attempts = 0
correct_pin = ‘1056’

while attempts < 3:
    pin = input(“Enter PIN:”)

    if pin == correct_pin:
        print(“You have successfully logged in!”)
        break

    else: 
        print(“Incorrect! Try again…”)

if pin != correct_pin:
print(“Oops. Seems like you’ve forgotten your PIN. Reset ur PIN to continue...”)
chevron_up