Write a python program using conditional statements design a login where a user will enter a username and password
A) on successful login a welcome message is displayed
B) on 3 attempts an invalid message is displayed informing the user of the attempts remaining
C)on the fourth unsuccessful attempt the program will exit and inform the user of failed attempts
attempts = 0
while attempts < 4:
username=input("Enter username: ")
password=input("Enter password: ")
if username == "admin" and password == "1111":
print("You're Welcome")
attempts = 5
else:
attempts += 1
print("Wrong username or password.")
if attempts == 3:
print("Wrong username or password. 1 attempts remaining")
if attempts !=5:
print("4 failed attempts")
Comments
Leave a comment