k = 1
a = []
for i in range(3):
a.append([])
for j in range(3):
a[i].append(k)
k = k + 1
for i in range(3):
print(*a[i])
(locals().update({'k': 1, 'a': []}), [(a.append([]), [(a[i].append(k), loc.update({'k': k+1})) for j in range(3)]) for loc in [locals()] for i in range(3)], [print(*a[i]) for i in range(3)])
a = [[k for k in range(x, x+3)] for x in range(1, 10, 3)]
for i in a:
print(*a)
a = []
for i in range(3):
a.append([])
# --- --- ---
a = [[] for _ in range(3)]
k = 1
a = []
for i in range(3):
...
k = k + 1
# --- --- ---
a = [[i, i+1, i+2] for i in range(1, 8, 3)]
for i in range(3):
print(*a[i])
# --- --- ---
for i in a:
print(*i)
from more_itertools import chunked
a = list(chunked(range(1, 10), 3))