Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #this program plays rock paper scissors
  2.  
  3. import random
  4. options = ['rock', 'paper', 'scissors']
  5.  
  6. print('Lets play rock paper scissors! Please enter 1 for rock, 2 for paper, or 3 for scissors.')
  7.  
  8. userChoice = options[int(input()) - 1]
  9. pcChoice = options[random.randint(0,2)]
  10.  
  11. print('You choose ' + userChoice)
  12. print('The computer chooses ' + pcChoice)
  13.  
  14. if userChoice == pcChoice:
  15. print('Its a draw!')
  16. #user chooses rock
  17. elif userChoice == options[0] and pcChoice == options[1]:
  18. print('Paper covers rock. You lose!')
  19. elif userChoice == options[0] and pcChoice == options[2]:
  20. print('Rock crushes scissors. You win!')
  21. #user chooses paper
  22. elif userChoice == options[1] and pcChoice == options[0]:
  23. print('Paper covers rock. You win!')
  24. elif userChoice == options[1] and pcChoice == options[2]:
  25. print('Paper is cut by scissors. You lose!')
  26. #user chooses scissors
  27. elif userChoice == options[2] and pcChoice == options[0]:
  28. print('Scissors are crushed by rock You lose!')
  29. elif userChoice == options[2] and pcChoice == options[1]:
  30. print('Scissors cut paper. You win!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement