Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- print('You will be playing rock, paper, scissors against the computer.')
- ptChoice = int(input('Press "1" to select rock, "2" for paper, and "3" for scissors '))
- # prints participant's choice
- if ptChoice == 1:
- print('You have picked rock')
- elif ptChoice == 2:
- print('You have picked paper')
- elif ptChoice == 3:
- print('You have picked scissors')
- computerChoice = randint(1, 3)
- # prints computer's choice
- if computerChoice == 1:
- print('The computer has selected rock')
- elif computerChoice == 2:
- print('The computer has selected paper')
- elif computerChoice == 3:
- print('The computer has selected scissors')
- # prints who won
- if ptChoice == 1 and computerChoice == 2:
- print(' Paper beats rock. The computer wins')
- elif ptChoice == 1 and computerChoice == 3:
- print('Rock beats scissors. You win')
- elif ptChoice == 1 and computerChoice == 1:
- print('There has been a tie. Please play again.')
- elif ptChoice == 2 and computerChoice == 1:
- print('Paper beats rock. You win')
- elif ptChoice == 2 and computerChoice == 3:
- print('Scissors beats paper. The computer wins')
- elif ptChoice == 2 and computerChoice == 2:
- print('There has been a tie. Please play again.')
- elif ptChoice == 3 and computerChoice == 1:
- print('Rock beats scissors. The computer wins')
- elif ptChoice == 3 and computerChoice == 2:
- print('Scissors beats paper. You win')
- else:
- print('There has been a tie. Please play again.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement