PART A Write a Python 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 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)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 7E: (Simulation) Write a program to simulate the roll of two dice. If the total of the two dice is 7 or...
icon
Related questions
Question

PART A

Write a Python 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 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)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Mathematical functions
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr