 # Number Quiz

Apr 7th, 2019
114
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import random
2.
3. secret = random.randint(1,20)
4. guess = 0
5. tries = 0
6.
7. print('Try to guess a number between 1 and 20, You have 5 guesses')
8.
9. while (guess != secret) and (tries < 5):
10.     guess = int(input ("What is your guess? "))
11.     tries = tries + 1
12.     if guess == secret:
13.         print('You got it')
14.     elif tries == 1 and guess < secret:
15.         print('Your first clue is that your guess is too low, try again')
16.     elif tries == 1 and guess > secret:
17.         print('Your first clue is that your guess is too high, try again')
18.     elif tries == 2 and (secret/2)<7:
19.         print('No, sorry, your second clue is that the secret number divided by 2 is less than 7')
20.     elif tries == 2 and (secret/2)>=7:
21.         print('No, sorry, your second clue is that the secret number divided by 2 is >= 7')
22.     elif tries == 3:
23.         print('Still not right. Your third clue is that the floor division of the number / 3 = '+ str(secret//3 ))
24.     elif tries == 4:
25.         print('No, the final clue is that the modulus of the number / 4 = '+ str(secret%4))
26.
27. if guess!=secret:
28.     print ('Wrong, sorry, you have used up your five guesses. Better luck next time.')
29.     print ('The secret number was ' + str(secret))
RAW Paste Data