Hi,
I am new to Python, and have hit a WALL. Any help is appreciated! Below
is what I have so far, for the "High Low Game"...when I try to run it,
nothing happens, so I have been unable to finish it. I am sure it is
something simple...
#assignment 2 part 1 high low
def main():
print " Pick a number between 1 and 1000 and I will try to guess it"
print "in no more than 10 tries. After each guess, enter 0 if I"
print "got it right, -1 if I need to guess lower, and 1 if I need to"
print "guess higher."
high=1000
low=1
tries=1
while high > low:
ave=(high+low)/2
print "My guess is", ave,
guess=int(raw_input("Please enter '-1','0',or '1'):"))
print guess
if guess == 0:
print "That took 1", tries, "guesses."
elif guess == -1:
print "I will guess lower."
elif guess == 1:
print "I will guess higher."
else:
print "Pick a number between 1 and 1000 and I will try to guess
it"
print "in no more than 10 tries. After each guess, enter 0 if I"
print "got it right, -1 if I need to guess lower, and 1 if I need
to"
print "guess higher."
main()
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor