[Tutor] (no subject)
Thomi Richards
thomi@thomi.imail.net.nz
Wed, 14 Aug 2002 17:36:11 +1200
another thing you could do is this:
instead of going:
print "You've guessed",a,"times."
try this:
print 'You've guessed %d times!" % (a)
you can also do "things" within the brackets at the end. if you dont
understand, just ignore this message :-)
On Tue, 13 Aug 2002 19:10:48 -0700 (PDT) Thus said akira sugiura
<kodokuchef@yahoo.com>:
> Thank you Alan,
> =======================================================
> password = "foobar"
> a=0
>
> while password != "unicorn":
> print "You've guessed",a,"times."
> password = raw_input("Password?:")
> a=a+1
>
> if password=="unicorn":
> print "Welcome in, you took ", a, "attempts."
>
> #I added
> if a>3:
> print "That must've been complicated"
> =======================================================
> So, this "while loop" ends only when I enter
> unicorn.(right?)
> How can I make it ends either when I enter "unicorn"
> (right password) or wrong password more than three
> times?
> Probably I will learn it after I advanced more
> practices not now.
>
> Thanks anyway. I am enjoying learning python.(I guess)
>
>
> =====
> -----------------------------------
> Akira Sugiura
> kodokuchef@yahoo.com
> -----------------------------------
>
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Thomi Richards
thomi@imail.net.nz
http://thomi.imail.net.nz/
Thomi Richards,
thomi@imail.net.nz