You only have three attempts.
A four digit personal identification number (PIN) is required to access a system. If the user enters the PIN correctly they can continue. If the user enters the PIN incorrectly they are prompted for their PIN again. There are a maximum of three attempts, after which the user is locked out for security.
Write a program that asks the user to enter their PIN. If they enter the incorrect PIN three times, the program outputs, “Locked out.” If they correctly enter 7528 the program outputs, “Security check passed.”
Use this boilerplate code as a starting point:
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
Enter PIN: 2311
Enter PIN: 2213
Enter PIN: 7895
Locked out.
Enter PIN: 6753
Enter PIN: 9622
Enter PIN: 7528
Security check passed.
Enter PIN: 7528
Security check passed.
Use these resources as a reference to help you meet the success criteria.
Run the unit tests below to check that your program has met the success criteria.
Enter PIN: 1111
Enter PIN: 2222
Enter PIN: 3333
Locked out.
Enter PIN: 7528
Security check passed.
Enter PIN: 7582
Enter PIN: 7285
Enter PIN: 7528
Security check passed.
Check that you have: