[py] Solve 2022_01

This commit is contained in:
Joscha 2022-12-04 14:00:18 +01:00
parent 30e11343d1
commit 476d3bcccc
2 changed files with 10 additions and 1 deletions

8
py/aoc/y2022/d01.py Normal file
View file

@ -0,0 +1,8 @@
def solve(inputstr):
elves = []
for elfstr in inputstr.strip().split("\n\n"):
elf = sum(int(cal) for cal in elfstr.split())
elves.append(elf)
elves.sort()
print(f"Part 1: {elves[-1]}")
print(f"Part 2: {sum(elves[-3:])}")