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
Vlad1618 [11]
2 years ago
6

"write a program to play and score the paper-rock-scissor game. each of two users types in either p, r, or s. the program then a

nnounces the winner as well the basis for determining the winner: paper covers rock, rock breaks scissors, scissors cut paper, or nobody wins. be sure to allow the users to use lowercase as well uppercase letters. your program should include a loop that lets the user play again until the user says she or he is done."
Computers and Technology
1 answer:
algol132 years ago
8 0

The program is an illustration of conditional statements.

Conditional statements are used to execute instructions, if and only if certain <em>condition or conditions </em>are met.

Take for instance: <em>If b = 5, print "ab"</em>

The above print statement will only be executed, if the <em>value of b is 5</em>

The paper-rock-scissor program in Python where comments are used to explain each line is as follows,  

#This imports the random module

import random

#This is used to control the repetition of the game

playagain ="T"

#The following is repeated until the user chooses not to play again

while(playagain == "T"):

   #This generates a random choice for the computer

   computer = random.choice(['Rock', 'Paper', 'Scissors'])

   #This gets input for the player

   player = input('Choose: ')

   #If the player and computer choose the selection

   if player == computer:

       #Then, it's a tie

       print('A tie - Both players chose '+player)

   #If the player wins

   elif (player.lower() == "Rock".lower() and computer.lower() == "Scissors".lower()) or (player.lower() == "Paper".lower() and computer.lower() == "Rock".lower()) or (player == "Scissors" and computer.lower() == "Paper".lower()):

       #This prints "player won" and the reason

       print('Player won! '+player +' beats '+computer)

   #If otherwise,

   else:

       #This prints "computer won" and the reason

       print('Computer won! '+computer+' beats '+player)

   #This asks if the player wants to play again

   playagain = input("Play again? T/F: ")

At the end of each round,

  • The program displays the winner
  • Or prints a tie, if there's a tie

See attachment for sample run

Read more about conditional statements at:

brainly.com/question/22078945

You might be interested in
The part of the poppet valve that contacts the valve seat is called the A. face. B. margin. C. head. D. stem.
Phantasy [73]
It should be A face, I think
6 0
3 years ago
Read 2 more answers
Setting the isShowing property to false of the opacity property to o will delete an object from an Alice world.
Tema [17]
I think true I’m not for sure
5 0
3 years ago
Read 2 more answers
Crashing almost always accelerates the schedule while increasing project risk, whereas fast tracking almost always accelerates t
Ivahew [28]

Answer: False

Explanation: Because fast-tracking doesn’t involve additional resources, it’s usually best to start with this technique while Crashing requires careful planning to prevent “panic mode” among the project crews and to avoid acceleration claims.

4 0
3 years ago
The company called ____ offers a complete graphic information system software solution for computer-generated maps that stores a
jeyben [28]
The answer is <span>ESRI.  It </span>offers a complete graphic information system software solution for computer-generated maps that stores all its data in your oracle 10g database.  It stands for Environmental Systems Research Institute.  Esri's<span> GIS mapping software is the most powerful mapping and spatial data analytics technology available.</span>
7 0
3 years ago
Which of the following is not an example malicious code<br> A.Trojan horse B.worm C.virus D.spygear
umka21 [38]
B would be the correct answer

7 0
3 years ago
Read 2 more answers
Other questions:
  • PLEASE HELP!
    13·2 answers
  • Google Ads was designed to deliver three things to every advertiser: relevance, control, and results. It provides relevance by c
    11·1 answer
  • In Windows 7/Vista, the information that establishes basic settings such as the location of the operating system and other key s
    7·1 answer
  • How many bytes of information can be stored on a hard drive?
    7·1 answer
  • What was the technology that defined each of the four generations of computers?
    12·1 answer
  • Which command would you use to swap the words hither and yon on any line with any number of words between them? (You need not wo
    5·1 answer
  • CSCU EXAM TEST FINAL1-A software or hardware that checks information coming from the Internet and depending on the applied confi
    6·1 answer
  • Task 1
    9·1 answer
  • Help me to solve please​
    8·2 answers
  • Which device allows users to directly hear data from a computer
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!