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
Write a method that takes a Regular Polygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclu
Fantom [35]

Answer:

Answered below

Explanation:

//Program is written in Java programming language

Class RegularPolygon{

int sides = 0;

int length = 0;

}

public void randomize(RegularPolygon polygon){

int randomSides = (int) 10 + (Math.random() * 20);

double randomLength = 5 + (Math.random() * 11);

polygon.sides = randomSides;

polygon.length = randomLength;

}

8 0
3 years ago
Only the root user can modify a file that has the immutable attribute set.
Vladimir79 [104]
False if the roots modify it’s capable of it’s attributed set
8 0
1 year ago
If you’d like to have multiple italicized words in your document, how would you change the font of each of these words
Alex787 [66]

Answer:

Use styles and modify the font of the default style

Explanation:

4 0
2 years ago
Assume that the int variables i and j have been declared, and that n has been declared and initialized.
timama [110]

Answer:

public class num6 {

   public static void main(String[] args) {

       int n = 4;

       for(int i = 1; i <= n; ++i) {

           for(int j = 1; j <= i; ++j) {

               System.out.print("* ");

           }

           System.out.println();

       }

   }

}

Explanation:

This solution is implemented in Java

Two for loops are required for this (an inner nd outer for loop).

The innner and outer for loops can be seen as implementing rows and columns (so on the first 'row' i=1, so a single star is printed, on the second row, i =2, two stars are printed and so on, all on seperate lines)

8 0
3 years ago
True or false: offset printing has more expensive start up costs than than a digital printing system
denis-greek [22]

True Offset printing is more expensive.

Offset printing often has a longer turnaround and is more expensive to set up, so that for short print runs, the cost per unit is higher than digital printing.

5 0
2 years ago
Other questions:
  • In a game, your character cleverly places an electronic bug on an unsuspecting felon's jacket to track his movements. The bug tr
    10·2 answers
  • A transcript must bear a(n)___ to be considered official
    15·2 answers
  • Which website allows you to host your podcast for at a cost that includes your domain name?
    9·2 answers
  • What is not true about contracts?
    12·2 answers
  • Sandra is having difficulty with her reading assignment because she does not fully understand the language. Which online tool wo
    6·1 answer
  • A strategic information system can be any kind of information system that uses information technology to help an organization __
    11·1 answer
  • Which of the following best describes
    13·1 answer
  • Write an algorithm that accepts two numbers,
    7·1 answer
  • If Laura wanted to solve a problem using recursion where the last statement executed is the call to the same method, what type o
    8·1 answer
  • 9.19 LAB: Words in a range (lists) Write a program that first reads in the name of an input file, followed by two strings repres
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!