SHARE
TWEET

Untitled

a guest Apr 9th, 2020 210 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """
  2. make a Rock, Paper, Scissors game and play against the computer.
  3. You and the computer both choose rock, paper or scissors.
  4. The winner is decided by these rules:
  5. Rock blunts scissors
  6. Paper covers rock
  7. Scissors cut paper
  8. """
  9. from random import randint
  10.  
  11. player = input("rock(r), paper(p), or scissors(s)? ")
  12. print(player, "vs ", end="")
  13. number = randint(1, 3)
  14. # print(number)
  15. if number == 1:
  16.     computer = "r"
  17. elif number == 2:
  18.     computer = "p"
  19. else:
  20.     computer = "s"
  21. print(computer)
  22.  
  23. if player == computer:
  24.     print("DRAW!")
  25. elif player == "r" and computer == "p":
  26.     print("Computer wins")
  27. elif player == "p" and computer == "s":
  28.     print("Computer wins")
  29. elif player == "s" and computer == "r":
  30.     print("Computer wins")
  31. elif player == "p" and computer == "r":
  32.     print("Player wins")
  33. elif player == "s" and computer == "p":
  34.     print("Player wins")
  35. elif player == "r" and computer == "s":
  36.     print("Player wins")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top