newbie password question

Lee Harr missive at frontiernet.net
Sat Mar 2 17:53:58 EST 2002


On 02 Mar 2002 05:35:14 GMT, EtrOFsouls <etrofsouls at aol.com> wrote:
> Im a newbie to programming, and am having trouble with a certain task. I'd like
> to know how to keep track of how often a person guesses at a password and
> limits it to x many guesses. Here's a sample of what I've got so far.
> 
> password = "foobar"
> 
> while password != "unicorn":
>       password = raw_input ("Password:")
> print "Welcome In"
> 
> I understand all this (thank god), but I'm having trouble figuring out how to
> get it to keep track of the number of guesses and then print a message such as
> "Halt, you do not have access!" if the number of guesses exceeds the limit. I'm
> learning this thru on-line tutorials and this was given as an excersise. All I
> have to work with is variables and statements such as...while, if, elif and
> else. 
> 


You also might want to look at the getpass module.
(lets you get the password without echoing input)




More information about the Python-list mailing list