Passed
Push — main ( 4a9b5d...950843 )
by Yohann
01:31
created

main.main()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nop 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