Computers and Technology

I wrote a rock paper scissors game in python but I cannot get it to play again once the user choices a yes option. The rest of the program works. Here's what I have:
import random
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")
#Play again?
choice = input("Play Again? ")
while playAgain == True:
if choice == "y":
playAgain = True
elif choice == "yes":
playAgain = True
if choice == "Yes":
playAgain = True
elif choice == "Y":
playAgain = True
elif choice == "n":
print("Thanks for playing!")
exit()
elif choice == "no":
print("Thanks for playing!")
exit()
elif choice == "N":
print("Thanks for playing!")
exit()
elif choice == "No":
print("Thanks for playing!")
exit()
else:
print("Please input a vaild option.")
choice = input("Play Again? ")

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 20:20, jazzy4211
Sometimes writers elaborate on the truth when recalling past events so they can enhance their narrative essay with more interesting descriptions. do you feel that published writers should or should not embellish real life events just to make their stories more interesting?
Answers: 2
image
Computers and Technology, 22.06.2019 00:20, kcameronanderso
What’s resistance in an electrical circuit ?
Answers: 1
image
Computers and Technology, 22.06.2019 06:30, messyquestions
Plz 40 points what are raster vectors? a bitmap image a vector file a type of printing press a small projector
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, jhonpiper
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
Do you know the correct answer?
I wrote a rock paper scissors game in python but I cannot get it to play again once the user choices...

Questions in other subjects:

Konu
Physics, 15.04.2020 02:13
Konu
Mathematics, 15.04.2020 02:13