Skip to content

Instantly share code, notes, and snippets.

@Tyaedalis
Created February 19, 2012 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tyaedalis/1862619 to your computer and use it in GitHub Desktop.
Save Tyaedalis/1862619 to your computer and use it in GitHub Desktop.
Challenge #1 [difficult]
from random import *
min, max, result = 1, 100, ''
while result != 'y':
guess = randint(min, max)
result = raw_input('Is your number {}? (Y|H|L) '.format(guess)).lower()[0]
if result == 'h': max = guess
elif result == 'l': min = guess
print "Your number is {}.".format(guess)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment