This is in python code Congratulations! You\'ve just been hired by the FBI, and
ID: 3582131 • Letter: T
Question
This is in python code
Congratulations! You've just been hired by the FBI, and your boss needs your help unlocking a criminal's iPhone. The default iPhone passcode is exactly 4 digits long, each between 0 and 9. Assume someone else has already written a function test .password that takes a single string argument representing a possible passcode (with a length of exactly 4 characters.) test_password returns True if the input passcode unlocks the phone and False otherwise. Write a Python function crack_iphone that takes no arguments and returns a string representing the passcode that unlocks the phone. CAUTION: The string "0" is not a possible passcode, but "0000" is. def crack_iphone():Explanation / Answer
def crack_iphone():
for i in range(10000):
tryString = str(i).zfill(4)
if (test_password(tryString)):
return tryString
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.