Let me preface by saying that I am currently taking my first programming
class; so I have been a "programmer" for just over a week now.
Here is my question;
I
am trying to create a while loop that will allow me ask for a username
and password. If a wrong username and password is entered, I would like
the program to prompt the user to re-enter the username and password
until they get it correct. That means even if they get it wrong a
thousand times, I want to program to keep asking them.
This is my code;
[code]
username = ""
while not username:
username=raw_input("Username: ")
password = ""
while not password:
password=raw_input("Password: ")
if username == "john doe" and password == "fopwpo":
print "Login successful"
else:
print "Error. Please re-enter your username and password."
[code]
Andy Brunn
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor