Rock, Paper, Scissors Game with Python
Rock, Paper, Scissors
import random
r_p_s = ["Rock", "Paper", "Scissors"]
ran = random.choice(r_p_s)
user = 0
comp = 0
print("Welcome to Rock, Paper, Scissors game!!!")
print("Use R for Rock, P for Paper, S for Scissors")
points = int(input("How many points do you want "))
ask = input("Enter your choice: ")
while (user != points) and (comp != points):
if (ask == "R" or ask == "r") and ran == "Paper":
print(ran)
print("Oops!!")
comp += 1
if user == points:
print("Congratulations! You won!!")
elif comp == points:
print("Sorry!! Better Luck Next Time!!")
else:
ask = input("Enter your choice: ")
ran = random.choice(r_p_s)
elif (ask == "S" or ask == "s") and ran == "Rock":
print(ran)
print("Oops!!")
comp += 1
if user == points:
print("Congratulations! You won!!")
elif comp == points:
print("Sorry!! Better Luck Next Time!!")
else:
ask = input("Enter your choice: ")
ran = random.choice(r_p_s)
elif (ask == "P" or ask == "p") and ran == "Scissors":
print(ran)
print("Oops!!")
comp += 1
if user == points:
print("Congratulations! You won!!")
elif comp == points:
print("Sorry!! Better Luck Next Time!!")
else:
ask = input("Enter your choice: ")
ran = random.choice(r_p_s)
elif (ask == "R" or ask == "r") and ran == "Scissors":
print(ran)
print("Great!!")
user += 1
if user == points:
print("Congratulations! You won!!")
elif comp == points:
print("Sorry!! Better Luck Next Time!!")
else:
ask = input("Enter your choice: ")
ran = random.choice(r_p_s)
elif (ask == "P" or ask == "p") and ran == "Rock":
print(ran)
print("Great!!")
user += 1
if user == points:
print("Congratulations! You won!!")
elif comp == points:
print("Sorry!! Better Luck Next Time!!")
else:
ask = input("Enter your choice: ")
ran = random.choice(r_p_s)
elif (ask == "S" or ask == "s") and ran == "Paper":
print(ran)
print("Great!!")
user += 1
if user == points:
print("Congratulations! You won!!")
elif comp == points:
print("Sorry!! Better Luck Next Time!!")
else:
ask = input("Enter your choice: ")
ran = random.choice(r_p_s)
else:
print(ran)
print("Tie")
ask = input("Enter your choice: ")
ran = random.choice(r_p_s)
Post a Comment