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.

20 lines
369 B
Python

fi = open("in.txt", "r")
lst = []
tempLi = []
for li in fi.readlines():
if not li == "\n":
tempLi.append(int(li))
if li == "\n":
lst.append(tempLi)
tempLi = []
su = map(sum, lst)
print(f"part 1: {max(su)}")
sumList = [num for num in map(sum, lst)]
sumList.sort(reverse=True)
print(f"part 2: {sumList[0] + sumList[1] + sumList[2]}")