Created
December 1, 2022 17:26
-
-
Save albertein/868922bd95012b846e6496abfc54e354 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elves = [] | |
current_elf = 0 | |
with open('input.txt', encoding="utf-8") as file: | |
for line in file.readlines(): | |
line = line.strip() | |
if line == '': | |
elves.append(current_elf) | |
current_elf = 0 | |
continue | |
current_elf += int(line) | |
elves.append(current_elf) | |
print(sum(sorted(elves)[-3:])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment