Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('Hello.')
- low=0
- high=101
- guess=50
- print('Pick a secret number between 0 and 100.')
- while(True):
- print('Is your secret number', guess)
- inp = input('Enter yes/higher/lower:\n')
- if inp == "yes":
- print('Great!')
- elif inp=="lower":
- high = guess
- guess = (guess-low)//2+low
- elif inp=="higher":
- low = guess
- guess = (high-guess//2+guess)
- else:
- print("I didn't understand")
- print('Next is',guess)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement