Skip to content

Instantly share code, notes, and snippets.

@ChanChar
Created February 21, 2015 19:13
Show Gist options
  • Save ChanChar/bc9f8306350d748d25f5 to your computer and use it in GitHub Desktop.
Save ChanChar/bc9f8306350d748d25f5 to your computer and use it in GitHub Desktop.
Rock Paper Scissors Solution
number_of_cases = int(input())
for case in range(number_of_cases):
games = [outcome for outcome in input().split()]
player1_score = 0
player2_score = 0
player1_wins = ["PR", "RS", "SP"]
player2_wins = ["RP", "SR", "PS"]
for game in games:
if game in player1_wins:
player1_score += 1
elif game in player2_wins:
player2_score += 1
if player1_score > player2_score:
print(1, end=' ')
else:
print(2, end=' ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment