1. from sys import exit
  2. from random import randint
  3.  
  4. i = 0
  5. while i < 101:
  6. comp_guess = randint(0, 100)
  7. print comp_guess
  8. attempts = 1
  9. response = raw_input("> ")
  10. if response == "H":
  11. attempts += 1
  12. i =+ 1
  13. comp_guess = comp_guess + attempts / 2
  14. elif response == "L":
  15. comp_guess = comp_guess - attempts / 2
  16. attempts += 1
  17. i += 1
  18. elif response == "E":
  19. print "Won! Your number was %d" %comp_guess
  20. print "It took me %d tries" % attempts
  21. exit(0)
  22. if i < 101:
  23. print "I think you cheated!"