Advertisement
Md_Nabeel

Rock Paper Scissor

Jul 4th, 2025
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | Gaming | 0 0
  1. import random
  2. ut=ct=0
  3. while(ut<5 and ct<5):
  4.     u=input("You: ")
  5.     if(u not in "RPS"):
  6.         print("Wrong input")
  7.         continue
  8.     c=random.choice("RPS")
  9.     print("Computer: ", c)
  10.     if u!=c:
  11.         if ((u=="R" and c=="P") or (u=="P" and c=="S") or (u=="S" and c=="R")):
  12.             ct+=1
  13.             print("Computer wins","\n")
  14.         elif ((u=="R" and c=="S") or (u=="P" and c=="R") or (u=="S" and c=="P")) :
  15.             ut+=1
  16.             print("You win","\n")
  17.         print("# User= ", ut,"\n","# Computer= ",ct,"\n")
  18. if ut==5:
  19.     print("Congratulations! You WON the Game")
  20. else:
  21.     print("### You LOST the Game ###")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement