Move into 2022 folder

This commit is contained in:
Mark Hoekveen
2024-11-11 09:05:01 +01:00
parent 9dd6a4f275
commit e0d955ec6f
28 changed files with 5 additions and 11 deletions
+19
View File
@@ -0,0 +1,19 @@
top_three = [0, 0, 0]
def insert(calories):
top_three.sort()
if calories > top_three[0]:
top_three.pop(0)
top_three.append(calories)
with open("input.txt", "r") as f:
count = 0
for line in f.readlines():
try:
count += int(line)
except:
insert(count)
count = 0
insert(count)
print(top_three[0] + top_three[1] + top_three[2])