forked from adventofcode/logan_2022
23 lines
457 B
Python
23 lines
457 B
Python
|
if __name__ == "__main__":
|
||
|
elves = []
|
||
|
|
||
|
with open('input', 'r') as f:
|
||
|
sum_ = 0
|
||
|
for line in f:
|
||
|
if line.strip() == '':
|
||
|
elves.append(sum_)
|
||
|
sum_ = 0
|
||
|
else:
|
||
|
sum_ += int(line.strip())
|
||
|
|
||
|
elves.append(sum_)
|
||
|
|
||
|
elves.sort(reverse=True)
|
||
|
|
||
|
largest = elves[0]
|
||
|
print(f'Max Value: {largest}')
|
||
|
|
||
|
top3 = elves[0] + elves[1] + elves[2]
|
||
|
|
||
|
print(f'Top 3: {top3}')
|