maynul67

Game: Rock Paper Scissors

Jul 20th, 2021
961
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Rock Paper Scissors\n--------------------------------")
  2. import random
  3. score_user = 0
  4. score_comp = 0
  5.  
  6. #first player who reaches 10, wins the game
  7. while score_user<10 and score_comp<10:
  8.     print("\n1. Rock\n2. Paper\n3. Scissors")
  9.     choice = int(input("Enter your Choice: "))
  10.     comp = random.randint(1,3)
  11.     if choice == 1 and comp == 2:
  12.         score_comp += 1
  13.         print("Computer chose :",comp,"\nYou lose!","\nuser",score_user,"\ncomputer",score_comp)
  14.     elif choice == 2 and comp == 3:
  15.         score_comp += 1
  16.         print("Computer chose :",comp,"\nYou lose!","\nuser",score_user,"\ncomputer",score_comp)
  17.     elif choice == 3 and comp == 1:
  18.         score_comp += 1
  19.         print("Computer chose :",comp,"\nYou lose!","\nuser",score_user,"\ncomputer",score_comp)
  20.     elif choice == 1 and comp ==3:
  21.         score_user += 1
  22.         print("Computer chose :",comp,"\nYou win!","\nuser",score_user,"\ncomputer",score_comp)
  23.     elif choice == comp:
  24.         print("Computer chose :",comp,"\nTie!","\nuser",score_user,"\ncomputer",score_comp)
  25.     elif choice == 2 and comp ==1:
  26.         score_user += 1
  27.         print("Computer chose :",comp,"\nYou win!","\nuser",score_user,"\ncomputer",score_comp)
  28.     elif choice == 3 and comp ==2:
  29.         score_user += 1
  30.         print("Computer chose :",comp,"\nYou win!","\nuser",score_user,"\ncomputer",score_comp)
RAW Paste Data