Question: Create the constants ROCK, PAPER, SCISSORS and update the code accordingly (i.e. there should only be one 'rock' in your code) Have only a single
-
Create the constants ROCK, PAPER, SCISSORS and update the code accordingly (i.e. there should only be one 'rock' in your code)
-
Have only a single exit point in the function. That is there should only be one return statement
-
Properly name the variable that you return (the one that holds the winner of RPS.
starter code
def winner_RPS(p1, p2): if p1 == p2: return None if (p1 == "paper" and p2 == "rock") or \ (p1 == "scissors" and p2 == "paper") or \ p1 == "rock" and p2 == "scissors"): return p1 return p2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
