Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inputLine = input()
- teams = dict()
- worms = set()
- while(inputLine != 'quit'):
- inputData = inputLine.split(' -> ')
- wormName, teamName, wormScore = inputData[0], inputData[1], int(inputData[2])
- if wormName not in worms:
- worms.add(wormName)
- if teamName in teams:
- teams[teamName][wormName] = wormScore
- else:
- teams[teamName] = {wormName: wormScore}
- inputLine = input()
- number = 1
- teamScores = dict()
- for team in teams:
- temp = teams[team].values()
- teamScores[team] = (sum(temp), -len(temp))
- for team in sorted(teamScores.keys(), key = lambda x: teamScores[x], reverse=True):
- print('{0}. Team: {1} - {2}'.format(number, team, teamScores[team][0]))
- number += 1
- for worm in sorted(teams[team].items(), key = lambda x: (x[1]), reverse=True):
- print('###{0} : {1}'.format(worm[0], worm[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement