Question: Write a Python program (rockpaperscissors.py) that does the following: Import the random module into your program Write a function called computerRPS) that uses the random
Write a Python program (rockpaperscissors.py) that does the following: Import the random module into your program Write a function called computerRPS) that uses the random number generator to return one of "rock, "paper", or "scissors" In the main() function, print a velcome message to the user Ask the user for their choice - rock/paper/scissors. Perform input validation and only accept valid input. Call the computeRPS) function and save the returned "computer's choice" value in a variable Display the user's choice and the computer's choice. Now as per the rules of the game, display whether the player or the computer is the winner. The rules are as follows: 1. If both the computer and the player pick the same (rock/paper/scissors), it is a tie. 2. Rock beats scissors. 3. Paper beats rock 4. Scissors beat paper Based on the rules mentioned above, determine whether it is a tie, or whether the computer won or whether the player won and display a message accordingly Ask the user if s/he wants to play again and go back to the beginning if the user enters a 'y'or Y. Perform input validation for the yeso option
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
