484,243 views
8 votes
8 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 Vmx
by
2.4k points

2 Answers

22 votes
22 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 Starbugs
by
2.8k points
13 votes
13 votes

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 Nocnokneo
by
2.8k points