from numpy import random
rows, cols = (4, 4)
arr1 = [[0] * cols] * rows
for i in range(rows):
for j in range(cols):
arr1[i][j] = i*j
print(arr1)
Output:
[[0, 3, 6, 9], [0, 3, 6, 9], [0, 3, 6, 9], [0, 3, 6, 9]]
from numpy import random
rows, cols = (4, 4)
arr1 = [[0] * cols] * rows
for i in range(rows):
for j in range(cols):
arr1[i][j] = i*j
print(arr1)
Output:
[[0, 3, 6, 9], [0, 3, 6, 9], [0, 3, 6, 9], [0, 3, 6, 9]]