| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import pathlib |
||
| 2 | from typing import List |
||
| 3 | |||
| 4 | |||
| 5 | def get_group_scores(data: List[str]) -> List[int]: |
||
| 6 | elves = [0] |
||
| 7 | |||
| 8 | for line in data: |
||
| 9 | if line: |
||
| 10 | elves[-1] += int(line) |
||
| 11 | else: |
||
| 12 | elves.append(0) |
||
| 13 | |||
| 14 | return sorted(elves) |
||
| 15 | |||
| 16 | |||
| 17 | def main(): |
||
| 18 | content = pathlib.Path('./input.txt').read_text() |
||
| 19 | elves = get_group_scores(content.splitlines()) |
||
| 20 | |||
| 21 | print('Part 1:', elves[-1]) |
||
| 22 | print('Part 2:', sum(elves[-3:])) |
||
| 23 | |||
| 24 | |||
| 25 | if __name__ == '__main__': |
||
| 26 | main() |
||
| 27 |