Share your repls and programming experiences

← Back to all posts
Rock Paper Scissor
Sureshbabubabu2 (0)

os.system("cls"if os.name == "nt" else 'clear')
while 1<2:
print("\n Rock Paper Scissors\n")
userinput = input("Choose your weapon [R]ock], [P]aper, or [S]cissors: " )
if userinput not in ["S" ,"R","P","s","r","p"]:
print("Please choose a Alphabeth amongs R,S,P")
continue
print("You chose: "+userinput)
choice =["R","P","S"]
oppnent = random.choice(choice)
print("I chose: "+oppnent)
if oppnent == str.upper( userinput):
print("TIE")
exit()
elif oppnent == "R" and userinput.upper() == "S":
print("I WON!")
exit()
elif oppnent == "S" and userinput.upper() == "P":
print("I WON!")
exit()
elif oppnent == "P" and userinput.upper() == "R":
print("I WON!")
exit()
else:
print("YOU WON!")