24 lines
504 B
Python
24 lines
504 B
Python
with open('input') as f:
|
|
list_array = f.readlines()
|
|
|
|
sun_array = []
|
|
count = 0
|
|
temp = 0
|
|
max = 0
|
|
top3 = []
|
|
for x in list_array:
|
|
|
|
if x != '\n':
|
|
temp += int(x)
|
|
else:
|
|
#print('total: ' + str(temp))
|
|
if temp > max: max = temp
|
|
top3.append(temp)
|
|
temp = 0
|
|
|
|
#print('total: ' + str(temp))
|
|
top3.append(temp)
|
|
print('The Elf with the most Calories carry ' + str(max))
|
|
print('The top 3 Elves are carrying ' + str(sum(sorted(top3,reverse=True)[:3])) + ' Calories')
|
|
|