Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # USERNAME AND PASSWORD CHECK WITH ATTEMPT COUNT
- import sys
- print ('Welcome to your program! We need to check some things to make sure it\'s you.')
- usercount=0
- passcount=0
- # username input and check
- while True:
- print ('What is your username?')
- username = input()
- if username == 'user':
- print ('Correct.')
- break
- elif username!='user':
- usercount+=1
- print ('Incorrect.')
- if usercount>2:
- print('Too many attempts! Goodbye!')
- sys.exit()
- # password input and check
- while True:
- print ('What is your password?')
- password = input()
- if password == '123':
- print ('Correct.')
- break
- elif password!='123':
- passcount+=1
- print ('Incorrect.')
- if passcount>2:
- print ('Too many attempts! Goodbye!')
- sys.exit()
- if username == 'user' and password == '123':
- print ('Access Granted!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement