Question
Python question Rock, Paper, Scissors is a two-player game in which each player chooses one of three items. If both players choose the same item,
Python question
Rock, Paper, Scissors is a two-player game in which each player chooses one of three items. If both players choose the same item, the game is tied. Otherwise, the rules that determine the winner are:
a. b. c.
Rock always beats Scissors (Rock crushes Scissors) Scissors always beats Paper (Scissors cut Paper) Paper always beats Rock (Paper covers Rock)
Implement function rps() that takes the choice ('R', 'P', or 'S') of player 1 and the choice of player 2, and returns -1 if player 1 wins, 1 if player 2 wins, or 0 if there is a tie.
>>> rps('R', 'P') 1 >>> rps('R', 'S') -1
>>> rps('S', 'S') 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started