AOC/2024/day03/part1.py

14 lines
213 B
Python
Raw Normal View History

2024-12-03 02:52:13 -05:00
import re
text: str
with open("input.txt") as f:
text = f.read()
total: int = 0
2024-12-03 04:15:53 -05:00
for x, y in re.findall("mul\(([0-9]{1,3})\,([0-9]{1,3})\)", text):
2024-12-03 02:52:13 -05:00
x, y = int(x), int(y)
total += x * y
print(total)