Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- secret = random.randint(1,20)
- guess = 0
- tries = 0
- print('Try to guess a number between 1 and 20, using the four clues if you need them, You have 5 guesses')
- while (guess!=secret) and (tries<5):
- guess = int(input ('What is your guess? '))
- tries = tries + 1
- if guess == secret:
- print('You got it')
- elif guess < secret:
- print('clue n. ‘,tries,‘ your guess is too low, try again')
- elif guess > secret:
- print('clue n. ‘,tries,‘ your guess is too high, try again')
- if guess!=secret:
- print ('Wrong, sorry, you have used up your five guesses. Better luck next time.')
- print ('The secret number was',secret)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement