Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- incorrect = 0
- max_tries = 6
- choices = ['Drake', 'swordfish']
- run = True
- while run:
- while incorrect < max_tries:
- user_input = input('Please enter username: ')
- if user_input not in choices:
- incorrect += 1
- print(f"{user_input} is incorrect. Please try again.")
- else:
- print(f"Welcome back {user_input}.")
- pass_input = input('Please enter password: ')
- if pass_input not in choices:
- incorrect += 1
- print("Password does not match. Please try again")
- else:
- run = False
- print('Access granted')
- sys.exit()
- if incorrect == max_tries:
- sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment