#!/bin/python
# Reversed Guessing Game:
# The computer will guess at a number selected at random by the user.
# User selects a number
# While the computer has not gotten the answer right:
# guess in the middle (50) (((max - min) / 2) + min)
# if the answer is higher guess the middle (75)
# else guess the middle (25)
# repeat.
raw_input("Pick any number between 1 - 100 and press <ENTER> to continue...")
min = 0
max = 100
guesses = 0
go = 1
while go:
guess = (((max - min) / 2) + min)
print "The computer guesses: ", guess
print "Is this guess right?"
response = raw_input("Respond with L (The answer is lower), H (The answer is higher), or YES (The answer is correct.) ")
if (response == "L"):
max = guess
elif (response == "H"):
min = guess
elif (response == "YES"):
print "The computer got it right! :)"
go = 0
else:
print "The answer you provided was not understandable, we will try again."
guesses += 1
raw_input("Press <ENTER> to exit.")