Write a Python program (using python 3.7.2) that lets the user play the game of 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. (Don’t display the
computer’s choice yet.)
2. The user enters his
or her choice of “rock”, “paper”, or “scissors” at the keyboard. (You can use
a menu if you prefer.)
3. The computer’s choice is displayed.
4. A winner is selected according to the following rules:
a. The rock smashes the scissors.
b. Scissors cuts paper.
c. Paper wraps rock.
d. If both players make the same choice it is a tie.
Print who the winner is.
Part B:
Once you have completed Part A continue playing, keeping track of how many wins, losses and ties. Add
an item to the menu that asks if the user wants to Quit. Keep playing until the user selects Quit. Print out the totals.
USE COMMENTS.
Notes: To generate a random integer 1 ,2 or 3:
Import random
num=random.randint(1,3)
Code:-
import random #importing libraries
win=0 #initially declare win with 0
lose=0 #initially declare lose with 0
tie=0 #initially declare lose with 0
while(True): #infinite loop
num=random.randint(1,3) #chose random number between 1 and 3
user=int(input("Enter Your Choice 1)rock 2)paper 3)scissors 4)quit:
")) #take input from user menu driven
if user==1: #if user selects rock
if num==1: #if computer chooses rock
print("Computer chooses rock")
print("Both chooses rock")
tie=tie+1
if num==2: #if computer chooses paper
print("Computer chooses paper")
print("paper wraps rock user loses")
lose=lose+1
if num==3: #if computer chooses scissors
print("Computer chooses scissors")
print("rock smashes scissors user wins")
win=win+1
elif user==2: #if user selects paper
if num==2: #if computer chooses paper
print("Computer chooses paper")
print("Both chooses paper")
tie=tie+1
if num==3: #if computer chooses scissors
print("Computer chooses scissors")
print("Scissors cuts paper user loses")
lose=lose+1
if num==1: #if computer chooses rock
print("Computer chooses rock")
print("paper wraps rock user wins")
win=win+1
elif user==3: #if user selects scissors
if num==3: #if computer chooses scissors
print("Computer chooses scissors")
print("Both chooses scissors")
tie=tie+1
if num==1: #if computer chooses rock
print("Computer chooses rock")
print("rock smashes scissors user loses")
lose=lose+1
if num==2: #if computer chooses paper
print("Computer chooses paper")
print("Scissors cuts paper user wins")
win=win+1
elif user==4: #if user want to quit
break
else: #if choice is invalid
print("Invalid choice")
print("Total Wins",win) #printing total wins
print("Total loses",lose) #printing total loses
print("Total ties",tie) #printing total ties
Code Screen Shot:-


Output:-

#Any Doubts please comment
Write a Python program (using python 3.7.2) that lets the user play the game of Rock,...
(c++ only)Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: When the program begins, the user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard using a menu in a function, userChoice, that returns a character. Next, there should be a function, computerChoice, that generates the computer’s play. A random number in the range of 1 through 3 is generated. If the...
In python language
Write a program that lets the user play the game of 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 and 3 is generated. 1 = Computer has chosen Rock 2 = Computer has chosen Paper 3 = Computer has chosen Scissors (Dont display the computer's choice yet) 2. The user enters his or her choice of “Rock”, “Paper", “Scissors" at...
C++ Part 2: Rock Paper Scissors Game Write a program that lets the user play this game against the computer. The program should work as follows: When the program begins, a random number between 1 and 3 is generated. If the number is 1, the computer has chosen rock. If the number is 2, the computer has chosen paper. If the number is 3, the computer has chosen scissors. Don't display the computer's choice yet. Use a menu to display...
IN JAVA. Write a program that lets the 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....
(Java) Write a program that lets the 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. The...
Write a program in python that lets the user play the game 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. 2 corresponds to paper, and 3 corresponds to scissors. To set up the random number library, write the following at the top of your code: import random random.seed(300) Use...
In JAVA Chapter 5Assignment(Rock, Paper, Scissors)–20pointsYour goal is towrite a program that lets the user play the game of Rock, Paper, Scissors against the computer.Your program should have the following: •Make the name of the project RockPaperScissors•Write a method that generates a random number in the range of 1 through 3. The randomly generated number will determine if the computer chooses rock, paper, or scissors. If the number is 1, then the computer has chosen rock. If the number is...
Write this program using C++ , (Rock, Paper, Scissors Game – Page 373) This programming assignment is from the textbook with some slight modifications and clarifications. Here is what I am going to except from you. Your program should include at least the following functions: getComputerGuess(): this function should return a random value generated by the computer using rand function (read more about random numbers in Chapter 3 pages 126 – 128). getUsersChoice(): this function will ask the user to...
Python Language: Please see program listed below of a game called: Rock, Paper, Scissors. Please add an exception, for example if the user inputs something else other than rock, paper or scissors, the exception will print message: "Enter only rock, paper, or scissors". Also add option to keep playing the game, for example: print: "Would you like to play again? Enter Y or N". If the user says Y, the game will repeat, if N, the game will end and...
Create a python program to play rock paper scissors using a while loop and if statements. I have started but have gotten stuck in a continuous loop. Please look over my code and help me find where I went wrong. Here it is: import random #Choice weapons=['Rock' ,'Paper' ,'Scissors'] print('Rock, Paper, Scissors!') print('Rock, Paper, Scissors!') print('Shoot!') human=input('Choose Rock, Paper, Scissors, or Quit! ') print('')#Blank Line while human != 'Quit': human_choice=human computer=random.choice(weapons) print(computer) if human==computer: print("It's a tie!") elif human=='Rock': if...