AOC/2023/day01/src/part1.py
2023-12-01 13:31:20 +01:00

12 lines
248 B
Python

text: str = open("input.txt", "r").read()
value: int = 0
for line in text.split("\n"):
for index, chars in enumerate([line[::-1], line]):
for char in chars:
if (char.isdigit()):
value += int(char) * 10 ** index
break;
print(value)