You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
396 B
27 lines
396 B
2 years ago
|
from os import remove
|
||
|
|
||
|
|
||
|
totals=[]
|
||
|
a=0
|
||
|
|
||
|
f = open('input1.txt', 'r')
|
||
|
inp = f.readlines()
|
||
|
|
||
|
for i in range(len(inp)):
|
||
|
inp[i] = inp[i].strip()
|
||
|
if inp[i] == '':
|
||
|
totals.append(a)
|
||
|
a=0
|
||
|
else:
|
||
|
a = a + int(inp[i])
|
||
|
|
||
|
print('answer part 1:', max(totals))
|
||
|
|
||
|
top3=0
|
||
|
|
||
|
for x in range(3):
|
||
|
top3 = top3 + max(totals)
|
||
|
totals.remove(max(totals))
|
||
|
|
||
|
print('answer part 2:', top3)
|