forked from adventofcode/logan_2022
Day 1 Part 1
This commit is contained in:
parent
f2105f0d76
commit
9ff8028933
2 changed files with 2270 additions and 0 deletions
15
day1/day1.py
Normal file
15
day1/day1.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
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]}')
|
2255
day1/input
Normal file
2255
day1/input
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue