Compare commits
No commits in common. "1081dde9f35f413ab5867e1b308b3525aea6334f" and "f2105f0d765f0f04a09d937fd1371e94d9c04263" have entirely different histories.
1081dde9f3
...
f2105f0d76
2 changed files with 0 additions and 2278 deletions
23
day1/day1.py
23
day1/day1.py
|
@ -1,23 +0,0 @@
|
||||||
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]}')
|
|
||||||
|
|
||||||
top3 = 0
|
|
||||||
for i in range(3):
|
|
||||||
largest = max(elves, key=elves.get)
|
|
||||||
top3 += elves[largest]
|
|
||||||
elves[largest] = 0
|
|
||||||
|
|
||||||
print(f'Top 3: {top3}')
|
|
2255
day1/input
2255
day1/input
File diff suppressed because it is too large
Load diff
Reference in a new issue