Coding Challenge: Designing for Failure

Test your skills on designing a system for failure detection by solving the exercise in this lesson.

We'll cover the following

Problem

You are going to crack a 2 digit pin code in the following exercise. This pin code is used to open the locker of a bank.

However, there is a security system deployed at the bank locker that pin cannot be entered twice within one second. So, if anyone wants to crack it, they would have to wait one second after every wrong attempt.

Your task is to crack the pin code using the library tenacity. The skeleton code is provided, and the crackPassword() function is also implemented, which generates a random 2 digit number and check if this is the pin.

The hacker knows that they can try every combination from 11 to 99. However, they believe that they can crack it faster by trying randomly.

Please use the coding playground to complete the task provided below.

To run the code below, press the Run button and run the command python tenacity-test.py.

Get hands-on with 1400+ tech skills courses.