Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = int(input("Choose your secret number: "))
- low = 1
- ans = (low + x) / 2
- print("Is your secret number", ans ,"?")
- g = 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. ")
- while ord(g) != ord('c'):
- if ord(g) == ord('l'):
- high = ans / 2
- elif ord(g) == ord('h'):
- low = ans
- print("Is your secret number", ans ,"?")
- g = 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. ")
- print("Your secret number is", ans ,".")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement