[Tutor] Need a Solution!
Alan Gauld
alan.gauld at btinternet.com
Thu Jun 11 23:12:20 CEST 2009
"Raj Medhekar" <cosmicsand27 at yahoo.com> wrote
> #guessing loop
> while guess != the_number and tries <5:
Well done you correctly spotted that you could use a boolean expression.
> if guess > the_number:
> print "Lower..."
> else:
> print "Higher..."
>
> guess = int(raw_input("Take a guess:"))
> tries += 1
>
> if tries > 5:
> guess == the_number
But you need to do the same thing here....
> print "You're right"
> else:
> print "You lose"
>
> raw_input("\n\nPress the enter key to exit")
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list