Advertisement
fooker

vault

Jan 6th, 2024
855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def vault() -> bool:
  2.  
  3.     pin = "".join([random.choice("0123456789abcdef") for _ in range(4)])
  4.     digits = ["z", "z", "z", "z"]
  5.     counter = 0
  6.  
  7.     print("What is the 4-digit PIN?")
  8.  
  9.     while True:
  10.  
  11.         attempt = list(input("Attempt> "))
  12.  
  13.         for _ in range(len(attempt)):
  14.  
  15.             digits.insert(0, attempt.pop())
  16.             digits.pop()
  17.  
  18.             if "".join(digits) == pin:
  19.                 return True
  20.  
  21.             counter += 1
  22.             if counter > MAX_DIGITS:
  23.                 return False
  24.  
  25.     return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement