From e97762a3f76e4862c8773c410864a66b4ba2b675 Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Tue, 3 Dec 2024 15:01:48 -0400 Subject: [PATCH] Add one liner --- 2024/03/solution.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/2024/03/solution.py b/2024/03/solution.py index e411095..34d76b6 100644 --- a/2024/03/solution.py +++ b/2024/03/solution.py @@ -10,6 +10,9 @@ for match in matches: total += int(match[0]) * int(match[1]) print(total) +# One-liner +# print(sum(int(x) * int(y) for x, y in re.findall(r"mul\((\d+),(\d+)\)", data, re.MULTILINE))) + # Part two matches = re.finditer(r"mul\((\d+),(\d+)\)", data, re.MULTILINE) total = 0