Last active
February 12, 2019 05:17
-
-
Save harrisonmalone/7dad3015a0dffa21be256c56a1e4280c to your computer and use it in GitHub Desktop.
first code wars problem solved in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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