AOC/2022/day01/alex.py
2024-08-29 17:12:29 +02:00

25 lines
444 B
Python

f = open("file", "r")
Calories = f.read()
f.close()
somme = []
sum = 0
l_calories = Calories.split("\n\n")
for i in l_calories:
liste = i.split("\n")
for j in liste:
sum += int(j)
somme.append(sum)
sum = 0
def sauver_noel(liste):
for i in range(1, len(liste)-1):
if liste[i-1] >= liste[i]:
maxi = liste[i-1]
else:
maxi = liste[i]
return maxi
print(sauver_noel(somme))