maxim, floor = int(raw_input('Pick a positive integer. Enter a max value now: ')),0
ceil = maxim
while True:
guess = (floor+ceil)/2
choice = raw_input("Is your number (h = higher, l = lower, y = yes) than %s: " %guess)
if choice == 'l':
ceil = guess
elif choice == 'h':
floor = guess
elif choice == 'y':
break
print 'Number was ',guess