From d38a7639081f24f3c2d8e754c1687b639c73aad3 Mon Sep 17 00:00:00 2001 From: Starnakin Date: Mon, 8 Dec 2025 12:30:58 +0100 Subject: [PATCH] add: day06: part1 --- 2025/day06/part1.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 2025/day06/part1.py diff --git a/2025/day06/part1.py b/2025/day06/part1.py new file mode 100644 index 0000000..cde391f --- /dev/null +++ b/2025/day06/part1.py @@ -0,0 +1,17 @@ +import math +text: str + +with open("input.txt") as f: + text = f.read() + +total: int = 0 + +lines: list[str] = text.splitlines() +numbers: list[list[int]] = [[int(nb_str) for nb_str in line.split(" ") if len(nb_str)] for line in lines[:-1]] +for i, operator in enumerate([operator for operator in lines[-1].split(" ") if len(operator)]): + if (operator == "+"): + total += sum([numbers[j][i] for j in range(len(lines) - 1)]) + elif (operator == "*"): + total += math.prod([numbers[j][i] for j in range(len(lines) - 1)]) + +print(total) \ No newline at end of file