Advertisement
raphtlw

Untitled

Oct 25th, 2019
385
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. answer = random.randrange(21)  # generates any random number from 0-20
  4.  
  5.  
  6. userinput = int(input('Guess a number from 0 to 20: ').strip())
  7.  
  8.  
  9. def verifyinput(value):
  10.     if value == answer:
  11.         print('Answer correct, you win!')
  12.         correct = True
  13.     elif value > answer:
  14.         print('Too high, try again!')
  15.     elif value < answer:
  16.         print('Too low, try again!')
  17.  
  18.  
  19. verifyinput(userinput)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement