Advertisement
Arthurious

Untitled

Oct 8th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import random
  2.  
  3. number_to_guess = random.randint(1, 101)
  4. boundary = 10
  5. guessed = 0
  6.  
  7. while guessed == 0:
  8.     user_input = input('Place your guess: ')
  9.     user_input = int(user_input)
  10.     if user_input == number_to_guess:
  11.         print("Good job!")
  12.         guessed = 1
  13.     elif abs(number_to_guess - user_input) <= boundary:
  14.         print("Close, but not close enough!")
  15.     else:
  16.         print("Sorry, you're nowhere close")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement