You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
404 B
Python
32 lines
404 B
Python
2 years ago
|
"""
|
||
|
Part 2
|
||
|
"""
|
||
|
|
||
|
print("Hello World!")
|
||
|
|
||
|
file = open("input/input", "r")
|
||
|
|
||
|
ELVES = []
|
||
|
current = 0
|
||
|
|
||
|
for line in file.readlines():
|
||
|
line = line.strip()
|
||
|
|
||
|
if line == "":
|
||
|
ELVES.append(current)
|
||
|
current = 0
|
||
|
else:
|
||
|
line = int(line)
|
||
|
current += line
|
||
|
|
||
|
ELVES.append(current)
|
||
|
|
||
|
|
||
|
ELVES.sort()
|
||
|
|
||
|
ELVES = list(reversed(ELVES))
|
||
|
|
||
|
answer = ELVES[0] + ELVES[1] + ELVES[2]
|
||
|
|
||
|
print(answer)
|