Question: Write a function rockPaperScissorsLizardSpock(player1, player2) that decides who wins in a game of rock-paper-scissors-lizard-Spock. Each of player1 and player2 is a string with value 'rock',

Write a function

rockPaperScissorsLizardSpock(player1, player2) 

that decides who wins in a game of rock-paper-scissors-lizard-Spock. Each of player1 and player2 is a string with value 'rock', 'paper', 'scissors', 'lizard', or 'Spock'. The function should return the value 1 if player 1 wins, -1 if player 2 wins, or 0 if they tie. Test your function by playing the game with the following main program:

def main(): player1 = input('Player1: ') player2 = input('Player2: ') outcome = rockPaperScissorsLizardSpock(player1, player2) if outcome == 1: print('Player 1 wins!') elif outcome == -1: print('Player 2 wins!') else: print('Player 1 and player 2 tied.')

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!