[Tutor] I am puzzled - help needed
Kent Johnson
kent37 at tds.net
Fri Apr 1 05:19:18 CEST 2005
John Carmona wrote:
> It is WORKING NOW!! You can imagine how long I have spent on that, but I
> have learnt so much. Many thanks to all the people that have helped me,
> you will probably see me around asking a zillion other (very basics)
> questions.
Congratulations! I have one^H^H^Htwo small notes below.
> ________________________________________________________
> from time import *
>
> b = int(time())
> b%100
If you say
b = b%100
then you remember the target number and you don't have to keep writing b%100, just use b.
> running = True
>
>
> while running:
> guess = int(raw_input ("Guess a number: "))
>
> if guess == b%100:
> print "Bravo, you guessed the right number"
>
> elif guess > b%100:
> print "Too high"
>
> else:
> print "Too low"
>
> else:
>
> print "just right"
>
> print "Done"
OK one more note, I don't see how you will ever get out of the loop, you never set running to False
or break.
Kent
More information about the Tutor
mailing list