Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #this program plays rock paper scissors
- import random
- options = ['rock', 'paper', 'scissors']
- print('Lets play rock paper scissors! Please enter 1 for rock, 2 for paper, or 3 for scissors.')
- userChoice = options[int(input()) - 1]
- pcChoice = options[random.randint(0,2)]
- print('You choose ' + userChoice)
- print('The computer chooses ' + pcChoice)
- if userChoice == pcChoice:
- print('Its a draw!')
- #user chooses rock
- elif userChoice == options[0] and pcChoice == options[1]:
- print('Paper covers rock. You lose!')
- elif userChoice == options[0] and pcChoice == options[2]:
- print('Rock crushes scissors. You win!')
- #user chooses paper
- elif userChoice == options[1] and pcChoice == options[0]:
- print('Paper covers rock. You win!')
- elif userChoice == options[1] and pcChoice == options[2]:
- print('Paper is cut by scissors. You lose!')
- #user chooses scissors
- elif userChoice == options[2] and pcChoice == options[0]:
- print('Scissors are crushed by rock You lose!')
- elif userChoice == options[2] and pcChoice == options[1]:
- print('Scissors cut paper. You win!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement