aoc2023/d01/run1.py

11 lines
247 B
Python

filename = "input.txt"
s = 0
with open(filename, 'r') as f:
for line in f.readlines():
mot=[]
for car in line:
if car.isdigit():
mot.append(car)
s+=int( "".join([mot[0], mot[-1]]) )
print(s)