We use itertools.product lib to run a map instead of double for loop.
This functions is actually creating a Cartesian product.
import itertools
size = 5
t_map = [[0 for _ in range(size)] for _ in range(size)]
# Run once for each cell.
for i, j in itertools.product(range(size), repeat=2):
t_map[i][j] = 1
# For example
#
# for i, j in itertools.product(range(2), repeat=2):
# print(i, j)
#
# output:
# 0, 0
# 0, 1
# 1, 0
# 1, 1
#
#
# for i, j in itertools.product(range(2), repeat=3):
# print(i, j)
#
# output:
# 0, 0, 0
# 0, 0, 1
# 0, 1, 0
# 1, 0, 0
# 1, 0, 1
# 1, 1, 0
# 1, 1, 1