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
Which of the following is a strength of fiscal policy?
Fynjy0 [20]
The answer to your question is b crowding out effect
7 0
3 years ago
This is Very very Important to me[BRAINLIEST)✅​
sineoko [7]

Answer:

Rom

mellisa

Explanation:

pls mark me BRAINLIAST

4 0
3 years ago
Steve is happy today but he ____ yesterday​
suter [353]

steve is happy today but he wasn't yesterday

3 0
3 years ago
Read 2 more answers
What is a quasi vpn?
Natasha2012 [34]

Answer:

i don't think there is such thing as a quasi vpn

Explanation:

6 0
3 years ago
What type of internet connection do you think you'd get in Antarctica?
rusak2 [61]
Hello!
My best guess is you would have to use mediocre satellites that float over for internet connection.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Create a funtion makeStudent(studentlist) where studentlist is your list of Student namedtuples The function should do the follo
    13·1 answer
  • What will allow you to purchase software without receiving full rights to the program?
    14·1 answer
  • . Dеclarе a onе-dimеnsional array of 30 doublеs (on thе stack) namеd rainfall
    11·1 answer
  • What languages do most of the students at Miami High School speak?
    6·2 answers
  • Briefly explain what is net neutrality and why is it important today
    15·1 answer
  • The _ are the devices that allow a computer system to communicate and interact with the outside world as well as store informati
    11·1 answer
  • What kind of software is Microsoft Outlook??
    15·2 answers
  • WILL UPVOTE ALL
    10·1 answer
  • Rita tried unsuccessfully to open a PDF file attachment in her Inbox by double-clicking the attachment in the Reading Pane. What
    8·1 answer
  • Why is it important to prepare the farm resources before you start working? explain​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!