Computers and Technology
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")

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:00, banna01man
You need a reliable network for about twenty-five computers that will be distributed across a large building. it is important that the network be relatively cheap. which topology should you use?
Answers: 1
image
Computers and Technology, 22.06.2019 15:30, mariap3504
Whats are the different parts of no verbal comunication, especially body language?
Answers: 3
image
Computers and Technology, 23.06.2019 09:30, cdavis379
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a. if the manual switch s is on, then the light l is on. b. besides the manual switch, there is a motion detector, m1, which activatesthis light. c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d. the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
image
Computers and Technology, 23.06.2019 23:30, huangjianhe135
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
Do you know the correct 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
Biology, 28.10.2019 07:31