Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Chrome File Edit View History Bookmarks People Tab Window Help O Sun 6:10 PM Q E Functions Review: SP2020-CSX Course Home C o c olin.instructure.com/courses/390620/pages/functions-review?module_item_id=12780227
Chrome File Edit View History Bookmarks People Tab Window Help O Sun 6:10 PM Q E Functions Review: SP2020-CSX Course Home C o c olin.instructure.com/courses/390620/pages/functions-review?module_item_id=12780227 a TE Reset Be sure to include comments with at least your name, and a brief descript 110% - + CO-LIN Account Dashboard e Courses Calendar Example run: (Your's may look different) ============== RESTART: C:\Users\jamie \Desktop\Exercise 5-21.py ======= Enter 1 for rock, 2 for paper, 3 for scissors: 2 Computer chose paper You chose paper You made the same choice as the computer. Starting over Enter 1 for rock, 2 for paper, 3 for scissors: 1 Computer chose scissors You chose rock Rock smashes scissors You win the game Would you like to play again? (Y or N)Y Enter 1 for rock, 2 for paper, 3 for scissors: 4 Computer chose scissors You chose something went wrong You made an invalid choice. No winner Would you like to play again? (Y or N)Y Enter 1 for rock, 2 for paper, 3 for scissors: 2 Computer chose scissors You chose paper Scissors cut paper The computer wins the game Would you like to play again? (Y or N)Y Enter 1 for rock, 2 for paper, 3 for scissors: 3 Computer chose paper You chose scissors Scissors cut paper You win the game Would you like to play again? (Y or N)Y Enter 1 for rock, 2 for paper, 3 for scissors: 1 Computer chose rock You chose rock Inbox Programming Assignments: Assignment 05: Function Review: Rock, Paper, Scissors Game NOTE: Make sure and include comments in your program. At a minimum it should include the author's name and a short program description. You will lose points if you have no comments. Write a program that uses Functions that lets the user play the game Rock, Paper, Scissors against the computer. The program should work as follows: 1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors.(Do not display the computer's choice yet!) To generate the random number, use this code: #do this only from random import randint once at the top of the file choice = randint(0,2) + 1 2. The user enters his or her choice of "rock," "paper," or "scissors" at the keyboard. 3. The computer's choice is displayed. 4. A winner is selected according to the following rules: o If one player chooses rock and the other player chooses scissors, then rock wins. ("Rock smashes scissors" should be displayed) o If one player chooses scissors and the other player chooses paper, then scissors wins. ("Scissors cut paper" should be displayed) o If one player chooses paper and the other player chooses scissors, then rock wins. ("Paper wraps rock" should be displayed) o If both players make the same choice, the game must be played again to determine the winner. 5. After the game has been played and the winner has been named, ask the user if they would like to play again. If so, restart the game. If not, end the game
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started