Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. # Intro (Imports randint function, prints out introductions)
  2. import random
  3. print ('There are three primary colours - red. yellow, and blue. You will have 2 guesses.')
  4. print ('But firstly, let us start with your name')
  5. name = input()
  6. a = ['red', 'yellow', 'blue']
  7. secretColour = random.choice(a)
  8. print ('Hello, ' + name + ', guess which is it - red, yellow, or blue')
  9.  
  10. #Colour guessing part. Creates a for loop. Break ends the loop after 2 incorrect guesses, or a correct guess.
  11. for guessesTaken in range(1, 3):
  12. print('Take a guess.')
  13. guess = int(input())
  14. if guess == str(secretColour):
  15. print('That is a number, silly.')
  16. elif guess != secretColour:
  17. print(' That is not it, chief.')
  18. else:
  19. break #Due to only 3 choices, we're not giving out hints like we would with a 1-10 guessing game
  20.  
  21. if guess == secretColour:
  22. print ('Looks like you ,' + name + ', are correct. It really was' + str(secretColour) + '!')
  23. else:
  24. print('It was ' + str(secretColour) + ', actually.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement