This repository has been archived on 2023-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
logan_2022/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}')