You are to write a program where the user plays Rock, Paper,…
Question Answered step-by-step You are to write a program where the user plays Rock, Paper,… You are to write a program where the user plays Rock, Paper, Scissors against the computer. To play this game, each player chooses one of three options: Rock, Paper, or Scissors. The winner is determined based on the following rule:Rock vs Scissors : Rock wins (Rock smashes Scissors)Scissors vs Paper : Scissors win (Scissors cut Paper)Paper vs Rock : Paper wins (Paper covers Rock)ObjectivesDesigning a solution with selection structuresContinued practice with functionsWork with random numbersUser Interface SpecificationsINPUTAfter displaying a user introduction,The program prompts the user for their choice (rock, paper, or scissors). Instruct the user to enter just the first letter: r, p, or s. Accept either a lower or upper case letter. < Or 0 for rock, 1 for paper, and 2 for scissor with menu driven program.>OUTPUTThe program then outputsThe user’s choice, as a complete word (rock, paper, or scissors).The computer’s choice, as a complete word (rock, paper, or scissors).The winner. The game is a draw, no winner, if both choices are the same.Code SpecificationsIf the user does not enter a valid option of r, p, or s, (lower or upper case), the program should display a helpful error message and then terminate (in other words, don’t execute the rest of the program). Please see how this occurs in the tip calculator example this week. Do not use sys.exit() or any other built-in function to terminate the program. The program should end when main() ends. Any function ends either when it reaches the end of its block or it returns.You will need to use the random module to generate the computer’s selection. You will find documentation for that module here There are several approaches you can take. One would be to generate a random integer, such as 1, 2, or 3, using the randint() method. Then you would have to implement code to translate the numeric value to a game option (rock, paper, scissors). Alternately, you can try using the choice() method (though this uses sequences, which you’d have to investigate on your own).You must come up with a design that uses decomposition. For example, you should have a function that implements the rules of the game: pass in the 2 choices and return the winner. Also, write a function that is passed in the user’s choice (a single letter) and returns the complete string for that choice, “Rock”, “Paper”, or “Scissors”. If you choose to generate random numbers for the computer’s choice, you should have a function that maps the random number to the game option. You may decide to add other functions as well. Don’t forget your main() function.NOTE ****: Your solution is limited to the topics covered so far this quarter: chapters 1, 2, 3, and 5. Do not use any type of repetition or data structure. Computer Science Engineering & Technology Python Programming CSC 110 Share QuestionEmailCopy link Comments (0)


