my solutions for advent of code 2022
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.

26 lines
396 B

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)