This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 10th, 2012  |  syntax: None  |  size: 0.57 KB  |  views: 110  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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!"
clone this paste RAW Paste Data