Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Please think of a number between 0 and 100!")
- high=100
- low=0
- correct=False
- while correct==False:
- average= ((high+low))/2
- print("Is your secret number "+str(average)+"?")
- valid=True
- while valid:
- guess=str(raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. "))
- if guess=="h":
- high=average
- if guess=="l":
- low=average
- if guess=="c":
- print ("Game over. Your secret number was: "+str(average))
- correct = True
- else:
- print("Sorry, I did not understand your input.")
- valid=False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement