The Rock, Paper, Scissors game rules are as follows: > If both the computer and the player pick the same (rock/paper/scissors), it is a tie > Rock beats scissors > Paper beats rock > Scissors beat paper Write a Python program (rockpaperscissors.py) that consist of three functions: > Main ➤ fComputerRPS (RPS = Rock Paper Scissors) > fDetermine Winner Import the random module into your program In function ComputerRPS do the following: > Use the random number generator to return one of "rock", "paper", or "scissors" In function main() do the following: > Print a welcome message to the user > Ask the user for their choice - rock/paper/scissors ➤ Perform input validation and only accept valid input, if validation fails, display input again (loop) > Call the fComputeRPS() function and save the returned "computer's choice" value in a variable ➤ Display the user's choice and the computer's choice (see output below) > Display the winner by calling function fDetermine Winner (see output below) > Ask the user whether they want to play again, accept lowercase and uppercase y as acceptable input o If yes, then call function main again In function fDetermine Winner do the following: > Define two input parameters, the user's choice and the computer's choice (Rock, Paper, or Scissors) > Based on the rules mentioned above, determine whether it is a tie, or whether the computer won or whether the player won Return a string summarizing the outcome of the game (this string will be displayed in function main), for example: o Computer wins (Paper beats Rock) or User wins (Rock beats Scissors)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

pythojn please thank y

The Rock, Paper, Scissors game rules are as follows:
> If both the computer and the player pick the same (rock/paper/scissors), it is a tie
> Rock beats scissors
Paper beats rock
Scissors beat paper
Write a Python program (rockpaperscissors.py) that consist of three functions:
➤ Main
> fComputerRPS (RPS = Rock Paper Scissors)
➤ Determine Winner
Import the random module into your program
In function ComputerRPS do the following:
> Use the random number generator to return one of "rock", "paper", or "scissors"
In function main() do the following:
➤
Print a welcome message to the user
> Ask the user for their choice - rock/paper/scissors
>
Perform input validation and only accept valid input, if validation fails, display input again (loop)
Call the fComputeRPS() function and save the returned "computer's choice" value in a variable
> Display the user's choice and the computer's choice (see output below)
➤ Display the winner by calling function fDetermine Winner (see output below)
> Ask the user whether they want to play again, accept lowercase and uppercase y as acceptable input
o If yes, then call function main again
In function fDetermine Winner do the following:
➤ Define two input parameters, the user's choice and the computer's choice (Rock, Paper, or Scissors)
➤ Based on the rules mentioned above, determine whether it is a tie, or whether the computer won or
whether the player won
➤
Return a string summarizing the outcome of the game (this string will be displayed in function main), for
example:
o Computer wins (Paper beats Rock) or User wins (Rock beats Scissors)
Transcribed Image Text:The Rock, Paper, Scissors game rules are as follows: > If both the computer and the player pick the same (rock/paper/scissors), it is a tie > Rock beats scissors Paper beats rock Scissors beat paper Write a Python program (rockpaperscissors.py) that consist of three functions: ➤ Main > fComputerRPS (RPS = Rock Paper Scissors) ➤ Determine Winner Import the random module into your program In function ComputerRPS do the following: > Use the random number generator to return one of "rock", "paper", or "scissors" In function main() do the following: ➤ Print a welcome message to the user > Ask the user for their choice - rock/paper/scissors > Perform input validation and only accept valid input, if validation fails, display input again (loop) Call the fComputeRPS() function and save the returned "computer's choice" value in a variable > Display the user's choice and the computer's choice (see output below) ➤ Display the winner by calling function fDetermine Winner (see output below) > Ask the user whether they want to play again, accept lowercase and uppercase y as acceptable input o If yes, then call function main again In function fDetermine Winner do the following: ➤ Define two input parameters, the user's choice and the computer's choice (Rock, Paper, or Scissors) ➤ Based on the rules mentioned above, determine whether it is a tie, or whether the computer won or whether the player won ➤ Return a string summarizing the outcome of the game (this string will be displayed in function main), for example: o Computer wins (Paper beats Rock) or User wins (Rock beats Scissors)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education