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