[Tutor] a simple password program
Nick Noda
simple_twist at adelphia.net
Thu Mar 11 16:09:54 EST 2004
hey guys,
i've only been using python for a few days now and i was following a non-programers tutorial. one of the excercises was to make a password program that after 3 incorrect guesses at the password tells the user that the pass was incorrect. this is what i got:
password = "foobar"
count = 0
while password != "nabbers":
if count < 3:
password = raw_input("Password:")
count = count + 1
else:
print "Too complicated, huh?"
print "Welcome inside."
i can get it to say "Welcome inside." if the pass is correct, but if the pass is guessed wrong three times it just keeps looping "Too complicated, huh?" i was wondering if it is supposed to do that or if there is a way that i can get it to say it once then quit. any help i would jump up and down for.
newbie to python,
Nick Noda
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.614 / Virus Database: 393 - Release Date: 3/5/04
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040311/afc813a9/attachment.html
More information about the Tutor
mailing list