Advertisement
Guest User

password input

a guest
Jun 15th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. passcode = ''
  2. password = 5762
  3. attempts = 0
  4.  
  5. def password_attempts(passcode, attempts):
  6.     while passcode != password:
  7.         attempts = attempts + 1
  8.         num = input("Password please: ")
  9.         num = len(num)
  10.         passcode = str(passcode) + str(num)
  11.         passcode = int(passcode)
  12.         print(passcode)
  13.         if attempts == 4:
  14.             return passcode, attempts
  15.  
  16.  
  17.  
  18. try_again = 'yes'
  19. while try_again == 'yes' or try_again == 'y':
  20.     if passcode == password:
  21.             print("Access Granted...")
  22.             break
  23.     elif attempts > 4:
  24.         print('Breaking...')
  25.         try_again = input("Try again? no to exit")
  26.     password_attempts(passcode, attempts)
  27.  
  28. print("Welcome to the end")
  29. print(passcode, attempts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement