summaryrefslogtreecommitdiff
path: root/2022/01/calories2.py
blob: bba30a212efbe524a6ed546878796da05c827895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
elf_cals = [0]
with open("input", encoding="utf-8") as f:
    foods = f.readlines()
i = 0
for food in foods:
    if food == "\n":
        elf_cals.append(0) 
        i += 1;
    else:
        elf_cals[i] += int(food)
top3 = sum(sorted(elf_cals, reverse=True)[:3])
print(f"sum of top 3 calories is {top3}")