2022 day 1
This commit is contained in:
15
2022/01/part2
Executable file
15
2022/01/part2
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
elves = []
|
||||
|
||||
with open('input') as f:
|
||||
elf = []
|
||||
for line in f:
|
||||
if line == "\n":
|
||||
elves.append(elf)
|
||||
elf = []
|
||||
else:
|
||||
calories = int(line)
|
||||
elf.append(calories)
|
||||
|
||||
print(sum(sorted(map(sum, elves), reverse=True)[0:3]))
|
Reference in New Issue
Block a user