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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!