Files
AdventOfCode/01/code.py
Aeryn Van Daele 1dbdc648aa cleanup
2024-12-02 21:39:18 +01:00

19 lines
411 B
Python

left = []
right = []
with open('input01.txt') as file:
for line in file:
left.append(line.split()[0])
right.append(line.split()[1])
left.sort()
right.sort()
out = 0
for i in range(0,len(left)):
cnt = 0
for j in range(0,len(right)):
if right[j] > left[i]:
out += int(left[i])*cnt
break
elif right[j] == left[i]:
cnt += 1
print(out)