commit 61718ca8b469ebad7ed59da0ed3c167046cd8e57
parent aa7ddad8c6949b5dfb7a4c77b49c5e65ae5aa782
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sun, 7 Dec 2025 06:55:24 +0100
Make part 1 of day 6 2025 more readable
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/2025/06/a.py b/2025/06/a.py
@@ -13,8 +13,7 @@ with fileinput.input() as lines:
a.append([int(x) for x in t if x != ''])
def sol(a, op, i):
- return (sum(a[j][i] for j in range(len(a))) if op[i] == '+'
- else reduce(mul, (a[j][i] for j in range(len(a))), 1))
-
+ col = [a[j][i] for j in range(len(a))]
+ return sum(col) if op[i] == '+' else reduce(mul, col, 1)
print(sum(sol(a, op, i) for i in range(len(a[0]))))