variable not being added, help

Bernd Zimmermann zimmermann.edv at t-online.de
Thu Nov 28 04:53:02 EST 2002


"stibbs" <stibbs at nothanks.foo> schrieb im Newsbeitrag
news:pan.2002.11.28.08.36.04.997032.60987 at nothanks.foo...
> i'm 100% sure the mistake is on my part, but i can't seem to figure out
> what the problem is, as you can see by my comment in the code i tried 2
> different ways. I am trying to add to pw_attempts and have it stick.
>
>
> #!/usr/local/bin/python
>
> import sys
>
> username = raw_input("username?\n")
>
> def getpass():
> try:
> pw_attempts
> except NameError:
> pw_attempts = 0
>
> password1 = raw_input("password?\n")
> password2 = raw_input("re-enter password.\n")
> #pw_attempts = pw_attempts + 1
>
> if password1 != password2:
> pw_attempts = pw_attempts + 1
>
> if pw_attempts > 2:
> sys.exit()
> print pw_attempts
> print "your password does not match! Try again\n"
> getpass()
> else:
> pass
> getpass()
> print "Passwords Matched!"





More information about the Python-list mailing list