Advertisement
Guest User

Untitled

a guest
Nov 16th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. Can you crack the secret
  2. attempt = 0
  3. guess = 0
  4. import random
  5. secret = random.randint(1,20)
  6. print('Guess a number that lies from 1 to 20, within 5 attempts, or face the number demons!!')
  7. while (guess !=secret) and (attempt <5)
  8. attempt = attempt +1
  9. elif tries >1 and guess <secret:
  10. print('Sorry your guess was too low, try again')
  11. elif tries >1 and guess >secret:
  12. print('Sorry your guess was too high, try again')
  13. guess = int(input ('What is your Number', attempt, 'guess?')
  14. if guess == secret:
  15. print ('Well done the number demons won't be visiting you!!')
  16. if guess!=secret:
  17. print ('Sorry your luck has run out')
  18. print ('If you had input',secret, 'then the number demons would not be visiting you!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement