add: 2024/day03/part1
This commit is contained in:
parent
91f1535c73
commit
7accf6c2e8
14
2024/day03/part1.py
Normal file
14
2024/day03/part1.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
text: str
|
||||||
|
|
||||||
|
with open("input.txt") as f:
|
||||||
|
text = f.read()
|
||||||
|
|
||||||
|
total: int = 0
|
||||||
|
|
||||||
|
for x, y in re.findall("mul\(([0-9]{0,3})\,([0-9]{0,3})\)", text):
|
||||||
|
x, y = int(x), int(y)
|
||||||
|
total += x * y
|
||||||
|
|
||||||
|
print(total)
|
Loading…
Reference in New Issue
Block a user