Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. from random import randint
  2. print('You will be playing rock, paper, scissors against the computer.')
  3. ptChoice = int(input('Press "1" to select rock, "2" for paper, and "3" for scissors '))
  4. # prints participant's choice
  5. if ptChoice == 1:
  6. print('You have picked rock')
  7. elif ptChoice == 2:
  8. print('You have picked paper')
  9. elif ptChoice == 3:
  10. print('You have picked scissors')
  11. computerChoice = randint(1, 3)
  12. # prints computer's choice
  13. if computerChoice == 1:
  14. print('The computer has selected rock')
  15. elif computerChoice == 2:
  16. print('The computer has selected paper')
  17. elif computerChoice == 3:
  18. print('The computer has selected scissors')
  19. # prints who won
  20. if ptChoice == 1 and computerChoice == 2:
  21. print(' Paper beats rock. The computer wins')
  22. elif ptChoice == 1 and computerChoice == 3:
  23. print('Rock beats scissors. You win')
  24. elif ptChoice == 1 and computerChoice == 1:
  25. print('There has been a tie. Please play again.')
  26. elif ptChoice == 2 and computerChoice == 1:
  27. print('Paper beats rock. You win')
  28. elif ptChoice == 2 and computerChoice == 3:
  29. print('Scissors beats paper. The computer wins')
  30. elif ptChoice == 2 and computerChoice == 2:
  31. print('There has been a tie. Please play again.')
  32. elif ptChoice == 3 and computerChoice == 1:
  33. print('Rock beats scissors. The computer wins')
  34. elif ptChoice == 3 and computerChoice == 2:
  35. print('Scissors beats paper. You win')
  36. else:
  37. print('There has been a tie. Please play again.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement