Question: Stage 1 Write your code in the rock_paper_scissors_1.py source code file. In this stage, a simplified version of the game played between two players will

 Stage 1 Write your code in the rock_paper_scissors_1.py source code file.In this stage, a simplified version of the game played between two

Stage 1 Write your code in the rock_paper_scissors_1.py source code file. In this stage, a simplified version of the game played between two players will be created. 1. Create a main () function that gets two user inputs, one for each player. Each input string is either 'rock', 'paper', or 'scissor'. Convert these inputs to lowercase. 2. Create a function named compare that has two parameters, one for each player's choice. The function will compare the two player choice parameters and return 0, 1, or 2 to the caller. The return value depends on if the player choices are a tie (returning 0), a win for player 1 (returning 1), or a win for player 2 (returning 2) Even though there are various ways to construct a logically correct solution for this function, they all require nested if-elif-else statements. 3. 4. Add an if-elif-else statement after the call to compare that outputs 'The game was a tie' 5. Modify the main () function to add a call to the compare function using the player choice inputs read from the user as arguments. Make sure to store the return value of the function in a variable. 'Player 1 wins!', or 'Player 2 wins!' based on the return value of compare(). Thoroughly test your code by running it with at least all 9 possible combinations of choices. Check the result of the program with the table given above to make sure your code is logically correct

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!