152k views
24 votes
Write A Code In Python

Code should be able to
- Save Usernames and Passwords that are entered
- Be able to login to an account when username or password is entered
- Allow Only 3 Log In Attempts

User Gondy
by
3.7k points

2 Answers

9 votes

Answer:

print('Enter correct username and password combo to continue')

count=0

while count < 3:

username = input('Enter username: ')

password = input('Enter password: ')

if password=='Hytu76E' and username=='bank_admin':

print('Access granted')

break

else:

print('Access denied. Try again.')

count += 1

User Alexandre Ardhuin
by
4.9k points
1 vote

Answer:

Here is my code below: username = 'Polly1220' password = 'Bob' userInput = input("What is your username?\ n") if userInput == username: a=input("Password?\ n") if a == password: print("Welcome!") else: print("That is the wrong password.") else: print("That is the wrong username.")

User Chang Ye
by
4.3k points