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

16 lines
391 B
Python
Raw Normal View History

2022-12-02 16:56:31 -05:00
if __name__ == "__main__":
elves = {}
with open('input', 'r') as f:
elf = 0
elves[0] = 0
for line in f:
if line.strip() == '':
elf += 1
elves[elf] = 0
else:
elves[elf] += int(line.strip())
largest = max(elves, key=elves.get)
print(f'Index: {largest}\nValue: {elves[largest]}')