from sys import exit from random import randint i = 0 while i < 101: comp_guess = randint(0, 100) print comp_guess attempts = 1 response = raw_input("> ") if response == "H": attempts += 1 i =+ 1 comp_guess = comp_guess + attempts / 2 elif response == "L": comp_guess = comp_guess - attempts / 2 attempts += 1 i += 1 elif response == "E": print "Won! Your number was %d" %comp_guess print "It took me %d tries" % attempts exit(0) if i < 101: print "I think you cheated!"