day01: python

This commit is contained in:
matthias@arch 2023-12-06 11:31:51 +01:00
parent b48c1e67ef
commit e656a6f8b3

1
01/day01.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import re import re
# part 1 # part 1
with open("input.txt", "r") as file: print("Part 1:", sum([int(match[0]+match[-1]) for match in [re.findall(r"\d", line) for line in file.readlines()]])) with open("input.txt", "r") as file: print("Part 1:", sum([int(match[0]+match[-1]) for match in [re.findall(r"\d", line) for line in file.readlines()]]))