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
Ghella [55]
3 years ago
9

Write a program that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can break a scissor, and a pa

per can cover 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. Allow the user to continue playing or quit.
Computers and Technology
1 answer:
Andrei [34K]3 years ago
8 0

Answer:

Explanation:

The following program is written in Python and follows all the instructions accordingly to create the rock paper scissor game as requested.

from random import randint

answers = ["Scissors", "Rock", "Paper"]

computer = answers[randint(0, 2)]

continue_loop = False

while continue_loop == False:

   

   player_choice = input("Choose a number, 0 = Scissors, 1 = Rock , 2 = Paper?")

   player_choice = answers[int(player_choice)]

   if player_choice == computer:

       print("Tie!")

   elif player_choice == "Rock":

       if computer == "Paper":

           print("You lose!", computer, "covers", player_choice)

       else:

           print("You win!", player_choice, "smashes", computer)

   elif player_choice == "Paper":

       if computer == "Scissors":

           print("You lose!", computer, "cut", player_choice)

       else:

           print("You win!", player_choice, "covers", computer)

   elif player_choice == "Scissors":

       if computer == "Rock":

           print("You lose...", computer, "smashes", player_choice)

       else:

           print("You win!", player_choice, "cut", computer)

   else:

       print("That's not a valid play. Check your spelling!")

   continue_or_not = input("Would you like to play again? Y/N")

   continue_or_not = continue_or_not.lower()

   if continue_or_not != "y":

       break

   computer = answers[randint(0, 2)]

You might be interested in
What is LATEX ? <br>create a latex command
AVprozaik [17]

Latex is a software used for writing daily life issue like integrations,fractions ,limits .

Lets see an example

\\ \bull\tt\longmapsto \displaystyle{\int}vdx

\\ \bull\tt\longmapsto \displaystyle{\lim_{x\to 0}}

5 0
3 years ago
You can access your programs, your documents, your printer, even help from
nirvana33 [79]
 I think it's B. The Start menu.                  
3 0
3 years ago
Read 2 more answers
How do i clear my search history ?
nydimaria [60]
If an iphone go to the open book icon then go to history and clear from there if on a laptop go to the top right and look at the three ... press it and go to history and press clear history I don’t remember about android
4 0
3 years ago
Read 2 more answers
Marisa wants to customize her computer's default firmware. ROM allows data to be changed or modified when necessary.
ludmilkaskok [199]

Answer: ROM stands for "Read-only memory", this is permanent, so false.

4 0
2 years ago
Read 2 more answers
Sue is installing a printer. What program will she need to get the printer to work with her computer? Specify some functionaliti
umka21 [38]

Answer:

Utility software tool​

Explanation:

After connecting the printer and turning it on, you'll need to install the printers software and drivers. Every printer should come with the software used to install a printer in Windows or your operating system.

8 0
3 years ago
Other questions:
  • What is an individual piece of data called in a database? coding A field B file C record or D tittle
    9·1 answer
  • Retype the statements, correcting the syntax errors.
    9·1 answer
  • When using Microsoft word, what would happen to the text of a paragraph if the "Justify" option is used?
    9·1 answer
  • How would you define media literacy?
    12·1 answer
  • How should resumes and cover letters be written to help you obtain a job that meets your
    14·1 answer
  • _____ selectors are used to select elements based on elements that are adjacent to them in the document hierarchy.
    9·1 answer
  • 5. Write<br>the<br>steps.<br>open<br>MS-<br>powerpoin<br>to<br>​
    11·1 answer
  • Write the algorithm for finding the perimeter of a rectangle using English like form step by step
    10·1 answer
  • What is a zerø-day exploit? No go.ogle &gt;:(
    10·1 answer
  • Write a code snippet Now write your own code snippet that asks the user to enter two numbers of integer type (one at a time) and
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!