daily pastebin goal
77%
SHARE
TWEET

RPS Cass L.

a guest Jan 16th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. choice = ["Rock", "Paper", "Scissors"]
  2. plpt = "Player wins the round! +1 to player."
  3. cppt = "Computer wins the round! +1 to computer." tie = "Tie! No one scores."
  4. import random #------------------------------------------------------------------- player_score = 0
  5. computer_score = 0
  6. while player_score or computer_score < 3:
  7. comp_choice = random.choice(choice)
  8. player_choice = input("Rock, Paper, or Scissors?").lower() if comp_choice == "Rock":
  9. if comp_choice == player_choice: print(tie)
  10. if player_choice == "paper": print(plpt)
  11. player_score += 1
  12. if player_choice == "scissors":
  13. print(cppt)
  14. computer_score += 1 if comp_choice == "Paper":
  15. if comp_choice == player_choice: print(tie)
  16. if player_choice == "rock": print(cppt) computer_score += 1
  17. if player_choice == "scissors": print(plpt)
  18. player_score += 1
  19. if comp_choice == "Scissors":
  20. if comp_choice == player_choice: print(tie)
  21. if player_choice == "paper": print(cppt) computer_score += 1
  22. if player_choice == "rock": print(plpt)
  23. player_score += 1 if computer_score == 3:
  24. break
  25. if player_score == 3:
  26. break
  27. if player_score == 3: print("Congratulations! You've won!")
  28. elif computer_score == 3:
  29. print("Sorry! Computer won this time.")
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