Advertisement
Fidd1ez

Untitled

Feb 1st, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. print('Hello.')
  2. low=0
  3. high=101
  4. guess=50
  5. print('Pick a secret number between 0 and 100.')
  6. while(True):
  7. print('Is your secret number', guess)
  8. inp = input('Enter yes/higher/lower:\n')
  9. if inp == "yes":
  10. print('Great!')
  11. elif inp=="lower":
  12. high = guess
  13. guess = (guess-low)//2+low
  14. elif inp=="higher":
  15. low = guess
  16. guess = (high-guess//2+guess)
  17. else:
  18. print("I didn't understand")
  19. print('Next is',guess)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement