Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def guess(x):
- random_number = random.randint(1, x)
- number = 0
- while number != random_number:
- try:
- number = int(input(f"Guess a number between 1 and {x}: "))
- except ValueError:
- print('Did you forget how to use your keyboard?')
- continue
- if number < random_number:
- print('Sorry, try again. You Have guessed too low')
- elif number > random_number:
- print("Easy there cowboy, too high")
- print(f'Fantastic. You guessed it, it was {random_number}!!!!')
- guess(1000000)
Advertisement
Add Comment
Please, Sign In to add comment