Question: Problem 3 Write a program that lets user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: When

 Problem 3 Write a program that lets user play the game

Problem 3 Write a program that lets user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: 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. (Don't display the computer's choice yet.) 1) The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. 2) The computer's choice is displayed 3) A winner is selected acceding to the following rules: - If one player chooses rock and other player chooses scissors, then rock wins. (Rock smashes scissors.) If one player chooses scissors and the other player choose paper, then scissors wins. (scissors cut paper.) - If one player chooses paper and the other play chooses rock, then paper wins. (Paper wraps rock.) If both players make the same choice, the game must be played again to determine the winner. Run your program several times. Below is an example output of how the program should function. Example output Enter 1 for rock, 2 for paper, 3 for scissors: 1 Computer chose rock You chose rock You made the same choice as the computer. Starting over Enter 1 for rock, 2 for paper, 3 for scissors: 2 Computer chose rock You chose paper You win the game. Enter 1 for rock, 2 for paper, 3 for scissors: 4 Computer chose paper You chose an invalid choice. No winner Enter 1 for rock, 2 for paper, 3 for scissors: 2 Computer chose rock You chose paper You win the game. Enter 1 for rock, 2 for paper, 3 for scissors: 3 Computer chose rock You chose scissors The computer wins the game. In [ ]: import random def rock_paper_scissors(): ### YOUR CODE HERE rock_paper_scissors()

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!