How would I add a play again feature to this RPS program in python using a while loop?

import random

choice = input("Enter Rock(R), Paper(P), or Scissors(S): ")

computer = random.randint(1, 3)

if computer == 1:

print("Computer played R.")

elif computer == 2:

print("Computer played P.")

else:

print("Computer played S.")

#Winning conditions

if computer == 1 and choice == "R":

print("Computer played Rock.")

print("Tie")

elif computer == 2 and choice == "P":

print("Computer played Paper.")

print("Tie")

elif computer == 3 and choice == "S":

print("Computer played Scissors.")

print("Tie")

elif computer == 1 and choice == "S":

print("Computer played Rock.")

print("You Lose")

elif computer == 2 and choice == "R":

print("Computer played Paper.")

print("You Lose")

elif computer == 3 and choice == "P":

print("Computer played Scissors.")

print("You Lose")

elif computer == 1 and choice == "P":

print("Computer played Rock.")

print("You Win")

elif computer == 2 and choice == "S":

print("Computer played Paper.")

print("You Win")

elif computer == 3 and choice == "R":

print("Computer played Scissor.")

print("You Win")

Answers

Answer 1

Answer:

import random

playAgain = True;

while playAgain == True:

   choice = input("Enter Rock(R), Paper(P), or Scissors(S): ")

   computer = random.randint(1, 3)

   if computer == 1:

    print("Computer played R.")

   elif computer == 2:

    print("Computer played P.")

   else:

    print("Computer played S.")

#Winning conditions

   if computer == 1 and choice == "R":

    print("Computer played Rock.")

    print("Tie")

   elif computer == 2 and choice == "P":

    print("Computer played Paper.")

    print("Tie")

   elif computer == 3 and choice == "S":

    print("Computer played Scissors.")

    print("Tie")

   elif computer == 1 and choice == "S":

    print("Computer played Rock.")

    print("You Lose")

   elif computer == 2 and choice == "R":

    print("Computer played Paper.")

    print("You Lose")

   elif computer == 3 and choice == "P":

    print("Computer played Scissors.")

    print("You Lose")

   elif computer == 1 and choice == "P":

    print("Computer played Rock.")

    print("You Win")

   elif computer == 2 and choice == "S":

    print("Computer played Paper.")

    print("You Win")

   elif computer == 3 and choice == "R":

    print("Computer played Scissor.")

    print("You Win")

   choice = input("Play Again?")

   if(choice == "n"):

     playAgain = False

   else:

     playAgain = True

Explanation:

Use a boolen variable and a while loop. The while loop will keep looping until it is false. In this case, I have it set up to keep looping unless the user enters n.

Tip: Make sure that all of the code is indented with the while loop.


Related Questions

Which branch of study can help Jessica study the concept of light

Answers

Answer:

Physics, Quantum Mechanics

Explanation:

Light is a stream of photons with no weight. If you want to dig deeper in this mysterious phenomena, you should study physics and quantum mechanics. Physics takes up things like the theory of relativity, which can be useful in studying spacetime and how light travels through it, and quantum mechanics, being the study of matter in an atomic level, should help you get an understanding on how photons of light travel and why they behave so strangely.

Answer:

Physics

Explanation:

how do I learn coding??? ​

Answers

Answer:

FIERST LEAR JS ( JAVIA SCRAP) NEXT DM ME ON DISCORD WHEN YOU HAVE THE BASE LERAL ON KAHN ACIMADY

Explanation:

Answer:codeacedmy

Explanation:it gives the best coding tutions

5 advantages of word processor ​

Answers

1) It is faster and easier than writing by hand.
2) You can store documents on your computer, which you cannot do on a typewriter.
4) There are more formatting choices with a word processor (the spelling, grammar and language tools).
5) You can print copies of your documents

two uses of hexadecimal

Answers

Answer:

it allows you to store more information using less space. It is fast and simple to convert between hexadecimal numbers and binary.

Explanation: Hexadecimal can be used to write large binary numbers in just a few digits. It makes life easier as it allows grouping of binary numbers which makes it easier to read, write and understand.

What happens if a sequence is out of order?

Answers

Answer:

If you are trying to put the events in order and they are out of order you will probaly get the question wrong so make sure the events are in order.

Explanation:

Answer: a, The program may not work correctly.

Explanation: Because I do coding, and learned this already.

As our use of the internet increases e-safety becomes essential.
Discuss why e-safety is needed.

Answers

Answer:

The answer is described below

Explanation:

E safety means means protection of private information and personal safety when using the internet. E safety involve the protection of private information, passwords against identity theft or property theft. A persons  private information, passwords can be gotten through the use of phishing or malwares.

Also, the use of internet has exposed people to cyber bullying(i.e abuse of an individual), stalking, engaging underage children into sexual relationships and sextortion.

E safety  help protect children from harmful content and services as those listed.

electricity was seen as a mysterious force and began to creat a stir when people called​

Answers

This isn't related to computers and when you look it up all it comes up with a Stars Wars.

Clicking on the cube that appears in the top right of the 3D view window will: (1 point)

create a new object
center the view on the terrain
undo your last action
toggle between orthographic and perspective view

Answers

Answer:

The correct option is;

Toggle between orthographic and perspective views

Explanation:

On a game design program such as Unity 3D, when the cube with colored pointers that can be located on the 3D view window is clicked, it will bring about a switch between the perspective or 90 degrees and orthogonal views which enables the display of the object in three dimension that appears more like real life figures.

Ok so I usually don’t do this but I just need an answer , on Instagram a notification popped up while I was watching someone’s story ,and it started by saying “Instagram is taking into
Account” but I couldn’t finish reading cuz I accidentally swiped to the next story,does anyone know what it might’ve said?thanks

Answers

Answer:

I think it was about cheaper ads on Instagram and how they are lowering their prices.

Explanation:

Answer:

That's never happened to me but I suspect that it's most likely just a random Instagram update that probably doesn't matter

Explanation:

who want points hehehhheheehhe

Answers

Answer:

yoo pap i :v

p

Explanation:

Answer:

Hey I want points

Explanation:

Because I am selfish and do not liking to get to my rewards

Five friends plan to try a startup. However, they have a limited budget and limited computer infrastructure. How can they avail the benefits of cloud services to launch their startup?

Answers

Answer:

Use the azure free $200/ google cloud $300 credit for your first year of business and as you go use the profits off of that to pay for your servers once that credit runs out....

Explanation:

Cloud servers usally run at a per house rate on $0.02 depending on what you need

What is the basic unit of measurement for RAM specs

Answers

Answer: RAM, random access memory is measured in GIGABYTES. Bsbdjdjdj

Answer: The basic unit of measurement for RAM specs is byte.

Question #1
Describe the issues regarding controlled airspace and minimum safe altitudes that affects an airborne pilot's decision-making.


Question #2
Describe how basic weather conditions such as wind, temperature, and precipitation will
affect a drone’s flight.


Question #3
Explain the role of the “Pilot-in-Command” and the “Remote-Pilot-in-Command.”


Question #4
Explain how a quadcopter maintains balanced flight while hovering.


Question #4
Explain how a quadcopter differs from an airplane to accomplish the maneuvers of pitch, roll, and yaw.

Answers

Answer:

1) Separation

2) Weather impacts on the ability to fly a drone

3) The Pilot-in-Command is in charge of a manned aircraft

The Remote-Pilot-in-Command is in charge of an unmanned aircraft

4) With the aid of a flight controller

5) A quadcopter is controlled by adjusting the rotor speeds

An airplane is controlled by adjusting the ailerons, elevator and rudder

Explanation:

1) Separation

Issues regarding controlled airspace and minimum safe altitudes that affects an airborne pilot's decision-making is called separation related issues

The concept of separation pertains to ensuring that an aircraft stays outside the minimum distance from other aircraft, obstacles or controlled airspace

Vertical Separation

The allowable vertical separation distance between two aircraft from  the ground surface up to 29000 feet is 300 meters

The allowable vertical separation distance between two aircraft above 29000 feet is 600 meters

Horizontal separation

Horizontal separation are required for two aircraft that are closer to each other than the allowable minimum vertical separation. Horizontal separation includes, procedural separation, longitudinal separation, radar separation and reduced separation

2)

Wind

When the wind speed is high, it limits the drone's ability to maintain its position drifting the aircraft to undesired direction of flight

Temperature

High temperatures causes the the drone's motor to work harder generating more lift force which lead to shorter flight times

Cold temperatures reduces the battery efficiency and can also lower the battery voltage below the critical voltage.

Precipitation

A drone's is not waterproof and flying a drone i the rain can damage the equipment

Flying a drone in the rain increases the difficulty in its operation especially in drones that makes use of cameras for their flight stability

Rainy conditions reduces the strength and control of remote controllers

There is reduced visibility of flight during rainfall

3) In an aircraft, the Pilot-in-Command (PIC) is the pilot primarily responsible for the safety and operation of the aircraft during flight

The Remote-Pilot-in-Command has the primary responsibility and authority for the operation of a remotely operated (small) aircraft system

4) A quadcopter maintains balanced flight by the information sent to control  the direction of the propeller and the orientation as well as the speed of the rotor controlled by flight controller through the electronic speed control circuit (ESC) to control the thrust, revolutions per minute (RPM) and the direction of the quadcopter

5) Pitch in a quadcopter is achieved by tilting to move forward

In an airoplane the pitch is controlled by the elevators

Roll in a quadcopter is achieved by increasing the rotation of the rotors on the one side and decreasing the rotor speed on the other side

Roll in an airplane is achieved by adjusting ailerons

Yaw in a quadcopter is the spin achieved by reducing the speed of the front rotor on the side opposite to the direction of the intended spin motion

Yaw in an airplane is achieved by adjusting the ruder and ailerons to turn the plane

How was the creation of the world wide web browser a stepping stone for future scientific breakthroughs?

Answers

Answer:

Following are the point that described the web browser for the stepping stone as a  future scientific breakthroughs.

Explanation:

Tim Berners Lee was the founder of world wide web .The Tim Berners Lee  is software engineer at CERN they had seen the troubling of exchanging the data .In that time there are various data in various computer .The Tim  Berners Lee  felt he had found the way for resolving this problem and develop a thing so that we can exchange the data in any where .In that time already lots of computer are already linked each other with the high speed of the internet so tim develop a new technology called hypertext .In the March 1989, in a paper titled  known as "Information Management" Tim is developed but this proposal is rejected .In the 1990 Tim is developed the three technology HTML ,URI and  HTTP   with the help of this the world wide web is developed and we can share the information anywhere in the world .The sharing of information in a easy way gives the future bright the person in anywhere in the world will access the data or the information also We cam communicate anywhere in the world by using email .

what is a segment

a length of uninterrupted cable connecting two devices
the main piece of cable in the network
a piece of hardware connecting pieces of cable
a set of data or information

Answers

A length of uninterrupted cable connecting two devices

needed urgently what are short cut keys

Answers

Answer:

Copy: Ctrl + C.

Cut: Ctrl + X.

Paste: Ctrl + V.

Maximize Window: F11 or Windows logo key + Up Arrow.

Task View: Windows logo key + Tab.

Switch between open apps: Windows logo key + D.

Shutdown options: Windows logo key + X.

Lock your PC: Windows logo key + L.

Explanation:

This is for windows. Most of these can be replaced by the command key instead of the control key on mac.

Answer:

some shortcut keys are:

Explanation:

ctrl + A - select all

ctrl + B - bold

ctrl + C - copy

ctrl + U - underline

ctrl + V - paste

ctrl + X - cut

ctrl + Y - repeat

ctrl + Z - undo

ctrl + P - print

ctrl + I - italic

ning and e-Publishing: Mastery Test
1
Select the correct answer.
Which statement best describes desktop publishing?
O A.
a process to publish drawings and photographs on different media with a laser printer
B.
a process to design and produce publications, with text and images, on computers
OC.
a process to design logos and drawings with a graphics program
OD
a process to publish and distribute text and graphics digitally over various networks
Reset
Next​

Answers

Answer:

B

Explanation:

I dont no if it is right but B has the things you would use for desktop publishing

Answer:

the answer is B.

a process to design and produce publications, with text and images, on computers

Explanation:

____ allow us to store a binary image in code. (1 point)
Bitmaps
Classes
Arrays
Unions

Answers

The answer is bitmaps.

Answer:

A. Bitmaps

Explanation:

Which of the following data structures can erase from its beginning or its end in O(1) time?

Answers

Where all "the following" i can help you but you said which of the folllowing and ther no picture or anything?

The stack data structure can erase from its beginning or its end in O(1) time.

The O(1) complexity is an illustration of getting operations done in a constant time.

Stack data structure uses the push and pop operations for inserting and deleting items in a linear or constant time.

This implies that, inserting an item into a stack happens in O(1) time, and also; removing an item from the stack, irrespective of the item location (beginning, end, or in between) happens in O(1) time.

Read more about data structure at:

https://brainly.com/question/21287881

can anyone help me quickly please ​

Answers

Answer:

command line interface

hope it helps u , stay safe

What are some technical challenges and questions that arise from the need to represent digital information in computers and transfer it between people and computational devices?

Answers

Answer:

security

Explanation:

One technical issue that arises from this is security. Many times the information that is being transferred is private or even valuable, therefore grabbing the attention of hackers/thief's that want this information. This makes security highly important, but making sure that the information is completely secure is impossible. The best that can be done is adding certain safety measures to secure the information as much as possible, which in term is a technical challenge.

Self-contained sequences of actions to be performed are: (1 point)

expressions
algorithms
functions
formulas

Answers

These are functions.

Answer:

god

Explanation:

god is always the answer

Which memory part is connected to the processor?Which memory part is connected to the processor?

Answers

Well they are all separate pieces but you might be talking about ram ram is the random access memory which the CPU goes into sometimes

Please help me guys! :))))) To activate the Spelling and Grammar check features, you can either navigate to the Review tab, or use the shortcut key _____. F9 Ctrl+F F7 Ctrl+H

Answers

Answer:

F7

Explanation:

I hope this helps! :)

Answer:

F7

Explanation:

Availability is an essential part of ________ security, and user behavior analysis and application analysis provide the data needed to ensure that systems are available.

Answers

Answer:

Network

Availability is an essential part of Network security, and user behavior analysis and application analysis provide the data needed to ensure that systems are available.

The ? bar gives you information related to the document such as slide number, theme and whether or not the computer has found an error in the text

Answers

Answer:

Status bar

Explanation:

The status bar is a horizontal bar usually located at the bottom of the screen or window, showing information related to a document being edited such as slide number, current theme template, spelling and grammar, language, zoom, notes, comments, permissions, signatures e.t.c.

It can be used to group information by dividing into sections and also provides several View options.

Could use help with the first or second one please! P

Answers

I think according on what I read about it I think it’s A.

A prefab allows you to reuse game objects over and over, while their component data remains intact. (1 point)

True
False

Answers

Answer:

True

Explanation:

A prefab allows you to reuse game objects over and over, while their component data remains intact.

A prefab serves as a store for components and values of game objects. This is turn makes the game objects a reusable asset.

In a prefab, there is no need to continuously copy and paste game objects as there are identical copies of the game objects in prefab.

Examples of situations where prefab is used is in:

a) In the creation of a Non Playing Character (NPC) that is found in some computer games. This characters come up at the exact moment that they are needed in games.

Tom only thinks about his own gain and does not care about the team objectives. What quality is he demonstrating? A. resourcefulness B. honesty C. dishonesty D. selfishness

Answers

Answer:

D. Selfishness

Explanation:

Selfishness is caring about yourself and not others

Answer:

selfishness

Explanation:

Write a Java program that prints out a 4x4 square (like the one below)




Answers

public class 4by4Square

{

    public static void main(){

       System.out.println("xxxx \nx  x\nx  x\nxxxx");

    }

}

~CaptnCoderYankee
Other Questions
please I need help to answer these questions The scatter plot shows the number of pigs and cows on various farms.Which farmers had more cows than pigs?Connie, Josie, Patrick, Mimi, EmmaConnie, Josie, Jackson, Jose'Mimi, Yosef, Jacob, Emiel, Jaylan, HaroldEmiel, Jackson, Jacob, Harold, Yosef Puji paid $7.50 for three pounds of gummy candy.Part AAssuming the cost per pound of gummy candy is proportional, complete the table of values representing the cost of gummy candy in pounds.(Please look at the graph uptop) How many faces does this figure have?A.TwoB.threeC.fourD.five Read this passage and identify the opinion Kamenexpresses. How does he support his opinion? I had just finished making a complicated piece ofequipment that was to be used for a show opening inPhiladelphia called "Fiorello." When the machine arrivedthey had trouble wiring it, so instead of going off tocollege that morning for an orientation, I spent severaldays at the theater fixing my light/sound equipment. Theshow received poor reviews, except for the mention byone reviewer of the "special effects," which, he wrote,were "outstanding."-"On Becoming an Inventor,J. Dean Kamen Will give brainliest if correct. the weather is____cold____hot.it's warm. which shows the equation below written in the form ax^2+bx+c=0 When lunging or squatting, your knees should not: A. Be out of alignment with your ankles B. Come forward past your toes C. Bend your knees to 45 degrees D. All of the above A toy rocket is launched straight up from the top of a building. The function that models the height as a function of time is h(t)=-16^2+200t+50. At what height was the rocket launched? The following transactions occur in November. November 1 Issue common stock in exchange for $11,800 cash. November 2 Purchase equipment with a long-term note for $2,300 from Spartan Corporation. November 4 Purchase supplies for $1,200 on account. November 10 Provide services to customers on account for $7,800. November 15 Pay creditors on account, $1,000. November 20 Pay employees $1,800 for the first half of the month. November 22 Provide services to customers for $9,800 cash. November 24 Pay $920 on the note from Spartan Corporation. November 26 Collect $5,800 on account from customers. November 28 Pay $1,000 to the local utility company for November gas and electricity. November 30 Pay $3,800 rent for November.Required:1. Record each transaction.2. Post each transaction to appropriate t-account. What is the median of the following set of data? 21, 4, 18, 9, 25, 16, 27, 30,33, 15, 31 In a lab, a colony of 100 bacteria is placed on a petri dish. The population triples every hour.1. How would you estimate or find the population of bacteria in:a. 4 hours?b. 90 minutes?c. 72 hour? Puerto Rico, Cuba, Jamaica, and Hispaniola have species of anole lizards with distinct body types, including the grass lizards, which have long tails; the canopy lizards, which have large toe pads; and the twig lizards, which have short legs. Anole species with each of these three body types exist on each of the:_________ Use the quadratic formula to solve the equation.4x^210x+5=0 Choose the correct interpretation of the above confidence interval. Note: 2 submissions allowed. 1) Since 0 is not in the confidence interval, the surveys provide evidence that the proportion of teens that text while driving is greater than the proportion of adults that text while driving. 2) Since the confidence interval is entirely positive, the surveys provide evidence that the proportion of teens that text while driving is greater than the proportion of adults that text while driving. 3) Since the confidence interval is entirely positive, the surveys provide evidence that the proportion of adults that text while driving is greater than the proportion of teens that text while driving.4) Since 0 is not in the confidence interval, the surveys provide evidence that there is no significant difference between the proportions of adults and teens that text while driving. The foundation of any short story's plot is Will mark Branliest for correct answers Ana works in the medical records department at a large medical office. Her job includes scanning and uploading medical records into an electronic health record system. Sometimes, Ana uses the work computer to check personal email and shop online; even though office regulations prohibit it.Step 2: Create a new thread and answer all three parts of the initial prompt below:Explain why Anas behavior is a potential threat to the electronic health records.Describe how Anas behavior could affect her employment.Pretend that you are Anas co-worker, what constructive advice would you give Ana about her on-the-job actions? He always calls me (negative)