+1 714-215-3097

(Solved) : Write Function Rockpaperscissorslizardspock Player1 Player2 Decides Wins Game Rock Paper S Q35592449

Write a function

rockPaperScissorsLizardSpock(player1, player2)

that decides who wins in a game ofrock-paper-scissors-lizard-Spock. Each of player1 and player2 is astring 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 byplaying 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.’)

Leave a Reply

Your email address will not be published. Required fields are marked *