On Mon, Jun 24, 2013 at 8:42 PM, John Gordon <gor...@panix.com> wrote:
> In <e41ce3a3-c8cb-4cfc-ba86-462f40f32...@googlegroups.com> 
> christheco...@gmail.com writes:
>
>> On Sunday, June 23, 2013 6:18:35 PM UTC-5, christ...@gmail.com wrote:
>> > How do I bring users back to beginning of user/password question once they
>> >
>> > fail it? thx
>
>> Can't seem to get this to cooperate...where does the while statement belong?
>
> while True:
>     username = raw_input("Please enter your username: ")
>     password = raw_input("Please enter your password: ")
>
>     if username == "john doe" and password == "fopwpo":
>         print "Login Successful"
>         break
>
>     else:
>         print "Please try again"

You didn’t test the code, did you?  Because the code you posted is
right.  Remember to always test code before submitting.  And note that
the getpass module is what you should use for that second thing in
real life, for the security of your users.

--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail                | always bottom-post
http://asciiribbon.org        | http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to