break the loop in one object and then return
apavluck at gmail.com
Mon Jun 26 19:44:20 CEST 2006
I am trying to write the following code to block up evaluation and
prompting for entering new information. However, when I break the loop
in one object and then return it does not start at the beginning again
but rather at the point where it exited. Can someone look at the
following code and give me some feedback.
yournum = input("I am thinking of a number between 1 and 100.\n Guess
which number: ")
mynum = (yournum-5)
if yournum == mynum:
print "Wow! You got it!"
elif yournum < mynum:
print "Nope. Too low"
elif yournum > mynum:
print "Oh, your too high"
yournum = input("guess again: ")
More information about the Python-list