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 objective fuction of linear progrmming should be
Minchanka [31]
The real-valued function whose value is to be either minimized or maximized subject to the constraints defined on the given LPP over the set of feasible solutions. The objective function of a LPP is a linear function of the form z = ax + by.
4 0
2 years ago
Which symbol is used for an assignment statement in a flowchart?
Pavlova-9 [17]

Equal symbol

equal symbol

Within most programming languages the symbol used for assignment is the equal symbol.

4 0
3 years ago
The buttons on a specific tab are organized into logical Ribbons. <br> T<br> F
NeTakaya
I believe the answer would be true
8 0
3 years ago
Read 2 more answers
A money ____ refers to moving a cash amount from one account to another.
Julli [10]
Money Transfer.
HOPE THIS HELPS!
5 0
3 years ago
Read 2 more answers
Do the following SQL questions. The resulting columns must all have descriptive names. You must show the result of the query. Fo
Maslowich

Answer:

We can use CREATE command to create tables with columns having descriptive names

Explanation:

Firstly, create a table using CREATE  command in SQL. The syntax is as follows:

CREATE TABLE [table_name]

(

 [col_name] [datatype]),

[col_name] [datatype]),

[col_name] [datatype]),

[col_name] [datatype])

)

Once the table is created, we can insert the data into table using INSERT command. It's syntax is as follows:

INSERT INTO table_name VALUES('', '', '')

if datatype is string, values must be entered within single quotes. If datatype is int, values are entered directly without using  quotes.

Now, you can select the data from  the table using SELECT command. It's syntax is as follows:

SELECT column-list FROM table_name

If you want to filter rows according to conditions, you can use WHERE command.

I have created  sample table and inserted some data into it. Now, I applied some queries on it to select data from the table.

I have written in a text file and attached the same. Please find. Thank you!

Download txt
3 0
3 years ago
Other questions:
  • 3) Write a program named Full_XmasTree using a nested for loop that will generate the exact output. This program MUST use (ONLY)
    6·1 answer
  • Richman Investments is an investment and consulting firm. Richman wants to expand its business operations both in the U.S. and i
    14·1 answer
  • Shania has started a new job as an app developer. Her first task was to make an old app designed for Android available on other
    6·1 answer
  • What computer system was the first to run the unix operating system?
    11·1 answer
  • A. true
    6·1 answer
  • When a rectangular region is defined using an appropriate style, which value matches the specified edge of the clipping region t
    7·1 answer
  • -The following type of Access form allows to see multiple records in an Excel-like arrangement of data fields:
    14·1 answer
  • HELP AASAP BRAINLIEST JUST HELP
    13·1 answer
  • Where ....................... the books that you borrowed? *
    5·1 answer
  • Leon needs to configure the days and times of his work week for his Outlook Calendar. Which option should he
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!