Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Last active February 12, 2019 05:17
Show Gist options
  • Save harrisonmalone/7dad3015a0dffa21be256c56a1e4280c to your computer and use it in GitHub Desktop.
Save harrisonmalone/7dad3015a0dffa21be256c56a1e4280c to your computer and use it in GitHub Desktop.
first code wars problem solved in python
def points(games):
three_points = []
one_point = []
for game in games:
home_team = game[0]
away_team = game[-1]
if home_team > away_team:
three_points.append(3)
if home_team == away_team:
one_point.append(1)
total = sum(three_points) + sum(one_point)
return total
total = points(['1:1','2:0','3:0','4:0','2:1','3:1','4:1','3:2','4:2','4:3'])
print(total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment