#!/usr/bin/env pythonimportsysdefdo_guess(guess,high,low,tries):ri=raw_input("Is your number %02d? (y)es, (h)igher, (l)ower: "%guess)c=ri[0].lower()ifc=="y":print"Wooho! Guessed it in %d tries!"%triessys.exit()else:tries+=1n=(high-low)/2ifnotn:n=1ifc=="h":low=guesshigh=guess=guess+nelifc=="l":high=guesslow=guess=guess-ndo_guess(guess,high,low,tries)defgame():guess=50high=guesslow=0tries=1print"Think of a number between 1 and 100, when you are ready, press enter!"sys.stdin.read(1)do_guess(guess,high,low,tries)if__name__=="__main__":game()