adventofcode2022/day1/day1.py
Logan G ae592b71af
Since everyone wanted me to use lists for D1, here you go
Also, zombie, your PR kinda sucked so I deleted it and made my own
2022-12-03 15:39:19 -07:00

24 lines
506 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_)
largest = max(elves)
print(f'Max Value: {largest}')
top3 = 0
for i in range(3):
largest = max(elves)
top3 += largest
elves.remove(largest)
print(f'Top 3: {top3}')