subject
Computers and Technology, 05.06.2020 18:03 1tzM3

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")

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:00, Emanuelle7843
Which action describes an aspect of technological design?
Answers: 1
image
Computers and Technology, 22.06.2019 22:20, kaiyerecampbell95
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
image
Computers and Technology, 24.06.2019 22:00, ivethzurita0425
What is a number system, and what is the total number of digits used in this system called? a number system is a system that uses different (options: a) numbers b) symbols c) codes d) digits e) alphabets) to represent different numbers. the total number of digits used in a number system is known as its (options: 1) processor 2) converter 3) radix 4) least significant digit 5) most significant digit)
Answers: 1
image
Computers and Technology, 25.06.2019 04:20, claraesson5581
Austin rare coins, inc., buys and sells rare coins, bullion, and other precious metals through eight web sites with different domain names. an unknown individual took control of austin's servers and transferred the domain names to another registrant without austin's permission. the new registrant began using the domain names to host malicious content—including hate letters to customers and fraudulent contact information—and to post customers' credit-card numbers and other private information, thereby tarnishing austin's goodwill. austin filed a suit in a federal district court against the new registrant under the anticybersquatting consumer protection act. is austin entitled to a transfer of the domain names? austin rare coins, inc., buys and sells rare coins, bullion, and other precious metals through eight web sites with different domain names
Answers: 3
You know the right answer?
How would I add a play again feature to this RPS program in python using a while loop? import rando...

Questions in other subjects:

Konu
Mathematics, 09.06.2021 17:30
Konu
Mathematics, 09.06.2021 17:30