AOC/2023/day01/src/part1.py

12 lines
248 B
Python
Raw Normal View History

2023-12-01 06:56:27 -05:00
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:
2023-12-01 07:30:16 -05:00
if (char.isdigit()):
2023-12-01 06:56:27 -05:00
value += int(char) * 10 ** index
break;
print(value)