Advertisement
c0d3dsk1lls

Rock Paper Scissors Game CodedSkills.net

Jul 30th, 2022
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. #ROCK PAPER SCISSORS GAME
  2. #CodedSkills.net 1337Tutorials.net
  3.  
  4.  
  5. import random
  6. while True:
  7.     choices = ["rock","paper","scissors"]
  8.     computer = random.choice(choices)
  9.     player = None
  10.  
  11.     while player not in choices:
  12.         player = input("rock, paper, or scissors?: ").lower()
  13.  
  14.     if player == computer:
  15.  
  16.         print("computer: ",computer)
  17.         print("player: ",player)
  18.         print("Tie!")
  19.     elif player == "rock":
  20.         if computer == "paper":
  21.             print("computer: ",computer)
  22.             print("player: ",player)
  23.             print("You lose!")
  24.         if computer == "scissors":
  25.             print("computer: ",computer)
  26.             print("player: ",player)
  27.             print("You win!")
  28.  
  29.     elif player == "scissors":
  30.         if computer == "rock":
  31.             print("computer: ",computer)
  32.             print("player: ",player)
  33.             print("You lose!")
  34.         if computer == "paper":
  35.             print("computer: ",computer)
  36.             print("player: ",player)
  37.             print("You win!")
  38.        
  39.     elif player == "paper":
  40.         if computer == "scissors":
  41.             print("computer: ",computer)
  42.             print("player: ",player)
  43.             print("You lose!")
  44.         if computer == "rock":
  45.             print("computer: ",computer)
  46.             print("player: ",player)
  47.             print("You win!")
  48.  
  49.  
  50.     play_again = input("Play again? (y/n): ").lower()
  51.     if play_again != "y":
  52.         break
  53. print("Bye!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement