Nice. I rewrote it with a while loop so if you get your password wrong it refreshes the input user = "charles" password = "admin123" def login(): print("Enter User & Password") def logged_in(): print("You are Logged in") quit() while True: entry1 = input("User Name: ") entry2 = input("Password: ") if entry1 == user and entry2 == password: print("Login Successful") logged_in() else: print("Login Failed")
Thank you Dr. These mini programs will surely improve my creativity and practice
You're welcome it's all good practice.
Nice. I rewrote it with a while loop so if you get your password wrong it refreshes the input
user = "charles"
password = "admin123"
def login():
print("Enter User & Password")
def logged_in():
print("You are Logged in")
quit()
while True:
entry1 = input("User Name: ")
entry2 = input("Password: ")
if entry1 == user and entry2 == password:
print("Login Successful")
logged_in()
else:
print("Login Failed")
Great stuff the while loop is handy the other way for me is a time saver.
Would it be better to use a while loop for the login or would it be about the same thing?
Quite possibly but the point with these programs is to explore the language while having a bit of fun with off the peg stuff.