commit 10caeb18b9c224c8b42ca724e956dba35807ec2c
parent bc79fa83d3cb63d8445312b47dbed9295809b28a
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Thu, 4 Dec 2025 10:38:46 +0100
Small cleanup
Diffstat:
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/2025/04/a.py b/2025/04/a.py
@@ -7,13 +7,14 @@ def neigh(a, i, j):
a[i+1][j-1], a[i+1][j], a[i+1][j+1],
].count('@')
-s = 0
with fileinput.input() as lines:
- a = [['.'] * 200]
- for line in lines:
- a.append(['.'] + list(line.replace('\n', '.')))
- a.append(['.'] * 200)
+ a = [
+ ['.'] * 200,
+ *[['.'] + list(line.replace('\n', '.')) for line in lines],
+ ['.'] * 200,
+ ]
+s = 0
for i in range(1,len(a)-1):
for j in range(1,len(a[1])-1):
if a[i][j] == '@' and neigh(a, i, j) < 4:
diff --git a/2025/04/b.py b/2025/04/b.py
@@ -7,13 +7,14 @@ def neigh(a, i, j):
a[i+1][j-1], a[i+1][j], a[i+1][j+1],
].count('@')
-s = 0
with fileinput.input() as lines:
- a = [['.'] * 200]
- for line in lines:
- a.append(['.'] + list(line.replace('\n', '.')))
- a.append(['.'] * 200)
+ a = [
+ ['.'] * 200,
+ *[['.'] + list(line.replace('\n', '.')) for line in lines],
+ ['.'] * 200,
+ ]
+s = 0
rem = True
while rem:
rem = False