r-p-s-lets-play

A tournament is going on in the Society Park. One of the game people are playing is Rock Paper Scissors. We all know Rock Paper Scissors game, but for a reminder, the rules are:
Paper always wins against Rock.
Rock always wins against Scissors.
Scissors always win against Paper.

Now the rules for scorecard:
For every game won, the player is awarded one point.
For every game tied, the player is awarded half of a point.
For every game lost, the player is awarded zero points.

Only a single player will win, namely the player with the most points. If several players have the same amount of points, the player which comes first in the input wins.

All players observe a simple strategy: each of them prepares a sequence of throws and plays the same sequence in every game. Character 'P' represents a Paper throw, 'S' represents a Scissors throw, and 'R' represents a Rock throw.

INPUT

First line of input gives T, the number of test cases.
T test cases follow, first line of each test case gives N the number of players.
Since the number of turns in game is fixed to 5, each string will be of length 5.

OUTPUT

Give the zero-based index of player who wins the game.

CONSTRAINTS
players will contain between 1 and 50 elements, inclusive.
Each element of players will contain exactly 5 characters.
Each element of players will contain only the characters 'P', 'R' and
   'S'.
1 ≤ T ≤ 50

SAMPLE INPUT
1
4
PPRRS
PPRRP
PPRSP
PPSSP

SAMPLE OUTPUT
0

Explanation

Player 0 will defeat players 1, 2 and 3 with 1, 2 and 3 throws won respectively so he gets 3 points. 

Player 1 will defeat players 2 and 3 with 1 and 2 throws won respectively so he gets 2 points. 

Player 2 defeats player 3 with 1 throw won so gets 1 point. 

Player 3 does not win a single game so he gets 0 points. 

The winner is player 0 with 3 points.
Another example for clarification of problem statement:
4
RRRRR
PPPPP
SSSSS
PPPPP

OUTPUT: 2

Player 2 defeats players 1 and 3 and loses to player 0 and has 2 points in total. 

Players 1 and 3 defeat player 0 and tie each other ending with 1.5 points. 

Player 0 defeats player 2 for 1 point in total.

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
def beats(throw1, throw2):	
	if(throw1 == 'P' and throw2 == 'R'):
		return True	
	elif(throw1 == 'R' and throw2 == 'S'):
		return True
	elif(throw1 == 'S' and throw2 == 'P'):
		return True
	
	return False		
		
T = int(input())

for i in range(T):
	N = int(input())
	players = list()
	points = [0]*N
	for j in range(N):
		curr = input()
		players.append(curr)
	for j in range(N):
		curr = players[j]
		for k in range(j+1,N):
				score1,score2 = 0,0
				for l in range(5):
					if( curr[l] == players[k][l]): continue
					if( beats(curr[l],players[k][l]) ):
						score1+=1
					else:
						score2+=1
				if(score1 == score2):
					points[j] += 0.5
					points[k] += 0.5
				elif(score1 > score2):
					points[j]+=1
				else:
					points[k]+=1
#	print points
	print(points.index(max(points)))