AOC/2022/day01/part2.py
2024-08-29 17:12:29 +02:00

13 lines
264 B
Python

f = open("file", "r")
str = f.read()
f.close()
lst = []
for paquet in str.split("\n\n"):
Sum = 0;
for sub_paquet in paquet.split("\n"):
if (sub_paquet != ""):
Sum += int(sub_paquet)
lst.append(Sum);
lst.sort();
print(sum(lst[-3:]))