Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- low, high = 0, 100
- ans = abs(high - low) // 2
- check=''
- print("Please think of a number between 0 and 100!")
- while True:
- print("Is your secret number " + str(ans) + "?")
- check = 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 check == 'c':
- print("Game over. Your secret number was: " + str(ans))
- break
- elif check == 'h':
- high = ans
- elif check == 'l':
- low = ans
- else:
- print("Sorry, I did not understand your input.")
- ans = (high + low) // 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement