first 13 stars

This commit is contained in:
Mark Hoekveen
2024-09-24 11:59:44 +02:00
commit 262ebfc619
20 changed files with 7895 additions and 0 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])