AdventOfCode/Python/2022/01/main.py

19 lines
294 B
Python
Raw Normal View History

2022-11-30 21:22:17 -08:00
input = open("input2", 'r')
2022-11-30 21:09:48 -08:00
2022-11-30 21:22:17 -08:00
data = []
2022-11-30 21:09:48 -08:00
2022-11-30 21:22:17 -08:00
elf = 0
curr = 0
2022-11-30 21:09:48 -08:00
for line in input:
if line == "\n":
2022-11-30 21:22:17 -08:00
data.append(curr)
curr = 0
2022-11-30 21:09:48 -08:00
else:
2022-11-30 21:22:17 -08:00
curr += int(line)
2022-11-30 21:09:48 -08:00
sortedData = sorted(data, reverse=True)
print(sortedData[0])
print(sortedData[0] + sortedData[1] + sortedData[2])