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]
2 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]2 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
When you're writing for mobile devices, use ________ to present the most important information first and provide successive laye
kogti [31]

Answer:

An inverted pyramid style.

6 0
2 years ago
Your job is to choose a data structure to implement polynomials whose coefficients are positive integers, such as 17x^4+4x^3+0x^
tatuchka [14]

Answer:

3

Explanation:

8 0
2 years ago
You’ve been stuck in bumper-to-bumper traffic for nearly an hour on a hot summer day. The temperature warning light has just com
nekit [7.7K]

Answer:

In a bumper-to-bumper traffic, when the engine starts overheating the situation can be handled by tapping the accelator which will revive the engine.

Explanation:

Overheating of engine can be due to many reasons. But one should know what to do when an engine overheats in a traffic. Bumper-to-bumper traffic is when the cars are so close in traffic that they touch each other. This usually happens when there's a traffic for a long time or on very busy lane. During summer times, it is important to keep checking the engine temperature to avoid any problem.

When one is stuck in bumper-to-bumper traffic with overheating engine, then there are some meausres that one can take. They are:

  • To put the car on park or neutral mode of driving and tap the accelator which will revive the engine.
  • The heat can be disperse by rolling down the window and turn the heater up. It will disperse the heat.

6 0
3 years ago
What category of predefined formulas in Excel contains the Boolean functions?
ololo11 [35]
The predefined formulas in Excel that contain the Boolean functions fall under the Logical Functions category. The Boolean functions consist of "AND", "OR", "XOR", "NOT", "IF", "IFERROR" and "IFNA".  When you need to use an Excel Function, you can type the function into the cell. You also need to add the arguments for the function in between brackets. If the function is complex or you are a beginner user, there is a function inputting tool which will help you choose which function you require. 

5 0
3 years ago
Jim has just purchased two new SCSI hard disk drives and a controller card for them. He properly installs the hardware in his ma
yawa3891 [41]

Answer:

  • Create partitions on each hard disk drives.
  • Mount the partition created on each hard drive so they are accessible by the the operating system.
  • Format the partitions created with a filesystem recognized by Linux.

Explanation:

Having purchased the two new SCSI hard disk drives with the controller cards for each and installed them properly, before using them for data storage and retrieval he must first use the fdisk command to create one or more partitions on each of the hard disk drives then mount any partitions created on the two hard drives so that they are accessible by the operating system before then proceeding to format any partitions created with a valid filesystem recognized by Linux.

4 0
3 years ago
Other questions:
  • If you delete an imessage does the other person see it
    12·1 answer
  • The objective of an Enterprise Resource Planning (ERP) system is to create a customized software program that integrates the inf
    14·1 answer
  • What do you mean by GIGO (Garbage-In-Garbage-Out) in computer system?​
    6·1 answer
  • Write a java program that prompts the user to input the elapsed time for an event in hours, minutes, and seconds. The program th
    13·1 answer
  • A10:A20 Refer to values in
    8·1 answer
  • What number will be output by the console.log command on line 5?
    9·1 answer
  • A UI text element must be added to ______.an empty background container game objecta prefaba slot game objecta tray objecta canv
    6·1 answer
  • What are the main types of database end users,? Discuss the main activi-ties of each
    10·1 answer
  • In order to get the maximum functionality out of a device that is plugged in, a user should download the specific ___ for that d
    10·2 answers
  • Do small companies need computers? why?<br>​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!