You are participating in a competition related to security, each participant is given a bank card and is asked to secretly set a 4-digit pin number for that card. The cards are then exchanged between participants. Each participant is given a card reading machine, where you can input the pin and the machine will tell you if the pin was correct or not. Your task is to find the pin entered by the other participant. A) What Al method will you use to obtain the 4-digit pin number stored in the card? [] B) Write a program in python that simulates the entire competition where the secret 4-digit number is entered by the user as an input. Then, simulate the card reader functionality where if the correct 4-digit key is provided it results with true value and false otherwise. Finally write your program that attempts to find the inputted number by using the simulated card reader only. [] C) Generate 100 random pins by going to the website https://www.coolgenerator.com/pin-generator. Run your code to find all these 4 digit pins and report the average time it takes the computer to find a solution. [] D) Repeat part (C) using 6-digit pins instead of 4-digit pins. Compare the time between finding the 4-digit number and the 6-digit number. Explain the difference in the result. [] Hint: You can use the timeit function in python to get the time. A sample code for timeit is given below: import timeit def test (n) : return sum (range (n)) n = 1000 1oop = 10 result = timeit.timeit('test (n)', globals-globals (), number r = 10c ) print (result / loop)
You are participating in a competition related to security, each participant is given a bank card and is asked to secretly set a 4-digit pin number for that card. The cards are then exchanged between participants. Each participant is given a card reading machine, where you can input the pin and the machine will tell you if the pin was correct or not. Your task is to find the pin entered by the other participant.
A) What Al method will you use to obtain the 4-digit pin number stored in the card? []
B) Write a
C) Generate 100 random
pins by going
to
the website
https://www.coolgenerator.com/pin-generator. Run your code to find all these 4 digit pins and report the average time it takes the computer to find a solution. []
D) Repeat part (C) using 6-digit pins instead of 4-digit pins. Compare the time between finding the 4-digit number and the 6-digit number. Explain the difference in the result. []
Hint: You can use the timeit function in python to get the time. A sample code for timeit is given below:
import timeit
def test (n) : return sum (range (n))
n = 1000
1oop = 10
result = timeit.timeit('test (n)', globals-globals (), number r = 10c ) print (result / loop)
Step by step
Solved in 4 steps with 4 images