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
According to the Bureau of Labor Statistics, how
Vladimir79 [104]

Answer:

one million

Explanation:

took test

7 0
3 years ago
Which of the following is not an advantage of concurrent design?
viva [34]

The answer I believe is B

7 0
3 years ago
Read 2 more answers
A string that contains only 0s,1s, and 2s is called a ternary string. How many strings of 10 ternary digits (0, 1, or 2) are the
alexdok [17]

Answer:

Number of strings = (10, 2)×(8,3) = 2520

Explanation:

The number of possible combinations for taking two 0's is C(10, 2)

It remains 8 Positions

The number of possible combinations for taking three 1's is C(8,3)

So there remains 5 spots

8 0
3 years ago
Read 2 more answers
In three to five sentences, explain the function of the computer's operating system.
Sati [7]

Answer:

An Operating System (OS) is an interface between a computer user and computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers.

Explanation:

3 0
3 years ago
Hypertension occurs when blood pressure is too high.
Ivan
True, hypertension is when your blood pressure is to high.
Please mark as brainliest
8 0
3 years ago
Other questions:
  • Please helpp!! I need it quickly!
    6·1 answer
  • You can precede a subquery with the ___ operator to create a conditiion that is true if one or more rows are obstained when the
    10·1 answer
  • How many ways can you add an image into google slides?
    8·1 answer
  • Each cout statement has a syntax error. Type the first cout statement, and press Run to observe the error message. Fix the error
    11·1 answer
  • . Write programming code in C++ for school-based grading system
    8·1 answer
  • Identify and explain 3 methods of automatically formatting documents​
    8·1 answer
  • Barbara, an employee, has properly connected her personal wireless router to a network jack inside her office. The router is una
    7·1 answer
  • True or False: A sequential search of a list assumes that the list elements are sorted in ascending order.
    13·1 answer
  • How to connect apple pencil 2 to ipad 8th generation?
    11·1 answer
  • How do u type please help
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!