Horribly noobful string question
SeNTry
wsw333 at yahoo.com
Wed Dec 14 20:23:36 EST 2005
SRY, that last bit of code got messed up. Hopefully it will look right
now...
#define two functions first, then use them.
def loopfunc(looping):
while looping:
guess= input("guess a number. see if you can guess what I'm thinking")
if guess == number:
print "you got it!"
looping=False
playagain("")
print "looping while statement now complete"
elif guess < number:
print "nope, a little higher!"
else:
print "no, a little lower!"
def playagain(again):
again=""
again= input("would you like to play again? type '1' for yes and '2' for
no")
if again==1:
print "great!"
loopfunc(True)
elif again==2:
print "aww! Ok, bye then"
return
else:
print "that's not a 1 or a 2! Try again!"
playagain("")
number=24
loopfunc(True)
>
>
More information about the Python-list
mailing list