Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- choice = ["Rock", "Paper", "Scissors"]
- plpt = "Player wins the round! +1 to player."
- cppt = "Computer wins the round! +1 to computer." tie = "Tie! No one scores."
- import random #------------------------------------------------------------------- player_score = 0
- computer_score = 0
- while player_score or computer_score < 3:
- comp_choice = random.choice(choice)
- player_choice = input("Rock, Paper, or Scissors?").lower() if comp_choice == "Rock":
- if comp_choice == player_choice: print(tie)
- if player_choice == "paper": print(plpt)
- player_score += 1
- if player_choice == "scissors":
- print(cppt)
- computer_score += 1 if comp_choice == "Paper":
- if comp_choice == player_choice: print(tie)
- if player_choice == "rock": print(cppt) computer_score += 1
- if player_choice == "scissors": print(plpt)
- player_score += 1
- if comp_choice == "Scissors":
- if comp_choice == player_choice: print(tie)
- if player_choice == "paper": print(cppt) computer_score += 1
- if player_choice == "rock": print(plpt)
- player_score += 1 if computer_score == 3:
- break
- if player_score == 3:
- break
- if player_score == 3: print("Congratulations! You've won!")
- elif computer_score == 3:
- print("Sorry! Computer won this time.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement