From 7accf6c2e8b4a05237c6014c7b19975065cbab75 Mon Sep 17 00:00:00 2001 From: Starnakin Date: Tue, 3 Dec 2024 08:52:13 +0100 Subject: [PATCH] add: 2024/day03/part1 --- 2024/day03/part1.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 2024/day03/part1.py diff --git a/2024/day03/part1.py b/2024/day03/part1.py new file mode 100644 index 0000000..a6a184f --- /dev/null +++ b/2024/day03/part1.py @@ -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) \ No newline at end of file