1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DedPeter [7]
3 years ago
12

Write a program that plays the popular scissor-rockpaper game. (A scissor can cut a paper, a rock can knock a scissor, and a pap

er can wrap a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws. Here are sample runs:
scissor (0), rock (1), paper (2): 1
The computer is scissor. You are rock. You won
scissor (0), rock (1), paper (2): 2
The computer is paper. You are paper too. It is a draw
Computers and Technology
1 answer:
kolbaska11 [484]3 years ago
8 0

Answer:

import random

computer = random.randint(0, 2)

user = int(input("scissor (0), rock (1), paper (2): "))

if computer == 0:

   if user == 0:

       print("The computer is scissor. You are scissor too. It is a draw")

   elif user == 1:

       print("The computer is scissor. You are rock. You won")

   elif user == 2:

       print("The computer is scissor. You are paper. Computer won")

elif computer == 1:

   if user == 0:

       print("The computer is rock. You are scissor. Computer won")

   elif user == 1:

       print("The computer is rock. You are rock too. It is a draw")

   elif user == 2:

       print("The computer is rock. You are paper. You won")

elif computer == 2:

   if user == 0:

       print("The computer is paper. You are scissor. You won")

   elif user == 1:

       print("The computer is paper. You are rock. Computer won")

   elif user == 2:

       print("The computer is paper. You are paper too. It is a draw")

Explanation:

*The code is in Python.

Import the random to be able to generate number number

Generate a random number between 0 and 2 (inclusive) using randint() method and set it to the computer variable

Ask the user to enter a number and set it to the user variable

Check the value of computer the computer variable:

If it is 0, check the value of user variable. If user is 0, it is a draw. If user is 1, user wins. If user is 2, computer wins

If it is 1, check the value of user variable. If user is 0, computer wins. If user is 1, it is a draw. If user is 2, user wins

If it is 2, check the value of user variable. If user is 0, user wins. If user is 1, computer wins. If user is 2, it is a draw

You might be interested in
What are some areas in Computer Science that make use of multivariate statistical testing or MCM methods? Explain why they are u
Nikolay [14]

Explanation:

Computational modeling is one of the areas of Computer Science that uses mathematical systems to perform multivariate statistical tests to solve highly complex problems in multidisciplinary areas, such as medicine, engineering, science, etc.

An example of the use of multivariate statistical tests is social development research in social science, which uses multiple variables to find more hypotheses and greater coverage between variables.

Multivariate statistical tests have the benefit of making research more effective and providing a more systematic and real view of the study.

6 0
3 years ago
1. “Paraan nga dyan, Liza!"<br> A.tae<br> B.utit<br> C.pwet
mariarad [96]

Answer:

B

Explanation:

3 0
3 years ago
Andrew frequently uses bullet points and numbered lists in his presentation to _____.
seraphim [82]

Hey there!


Andrew likely does this to convey a <em>point </em>easily. Bullet points offer a way to explain a topic, but in simple sentences that when all add up, explain it. They're meant to be short and sweet, and don't make the reader lose their attention.


Hope this helps!

5 0
4 years ago
Read 2 more answers
Messing around is driven by the user's:
Leni [432]

Answer:

The answer is C

Explanation:

I hope that the answer

8 0
3 years ago
Mục đính của thí nghiệm kiểm tra kĩ thuật
KIM [24]
Sorry i need points an i don’t understand✌
6 0
3 years ago
Other questions:
  • what would happen if a large number of computer users are attempting to access a web site at the same time that you are
    15·2 answers
  • Calculate the cash used to retire debt for each of the six months. Since the company can't pay down more debt than there is cash
    12·1 answer
  • How do you calculate typing speed
    8·1 answer
  • An ____ is a collection of tools, features, and interfaces that enables users to add, update, manage, access, and analyze the co
    10·1 answer
  • Write a program that has a while loop to print out the first five multiples of 15, 43, and 273 between the numbers of 3168 and 3
    8·1 answer
  • Primary memory consists of the various devices that are able to store data and programs even when the power is off. true or fals
    11·1 answer
  • Why is being distracted by the sights and sounds of our devices dangerous?​
    12·1 answer
  • I don't know what to do, anyone there?​
    13·1 answer
  • How can you prevent someone with access to a mobile phone from circumventing access controls for the entire device
    5·1 answer
  • What are common considerations businesses need to make before purchasing new computers? Check all of the boxes that apply.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!