aoc2023-py/day1a/__main__.py

21 lines
405 B
Python
Raw Normal View History

2023-12-05 09:27:53 +05:30
with open("./day1a/inputs.txt", "r") as file:
inputs = file.read().strip().split()
value = sum(
map(
lambda nums: int(
"".join([nums[0], nums[-1]]),
)
if len(nums) >= 2
else int(
"".join(nums * 2),
),
map(
lambda text: [c for c in text if c.isdigit()],
inputs,
),
)
)
print(f"{value=}")