aoc2023/d01/run1.py

11 lines
247 B
Python
Raw Permalink Normal View History

2023-12-02 07:11:19 +00:00
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)