[Tutor] password,while loops,

lumbricus@gmx.net lumbricus@gmx.net
Tue, 13 Aug 2002 04:32:04 +0200 (MEST)


> Hi,

Hello!

> Danny,Alan,Lumbricus

The name is Joerg - short J"o

> Thank you very much for a quick and helpful
> suggestion.
> It took me about 20 minutes to write this program(I
> dare to call this a program)and it worked ok.
> =======================================================
> password = "foobar"
> a=0
> 
> while password != "unicorn":
>     print "You've guessed",a,"times."
>     password = raw_input("Password?:")
>     if password!="unicorn":
>         a=a+1
>     elif password=="unicorn":
>           print "Welcome in"

You are testing for (password - "unicorn") three
times. Once should be enough. ;-)

> =======================================================
> PS, I am using the "A-Non Programmers Tutorial for
> Python"by Josh Cogaliati on web. I got there from
> python.org page.
> 
> Sincerely,
> 
> 
> 
> =====
> -----------------------------------
> Akira Sugiura
> kodokuchef@yahoo.com
> -----------------------------------

Greets, J"o!

-- 

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net