X = [[ 12 , 7 , 3,10 ], [ 4 , 5 , 6,20 ], [ 7 , 8 , 9,10 ]] Y = [[ 5 , 8 , 1,10 ], [ 6 , 7 , 3,20 ], [ 4 , 5 , 9,30 ]] Analysis: The two matrices are characterized by three rows and four columns, then a for loop controls the row and a control column, and then takes out each data, Then add and return to an empty matrix. The outer loop controls the row and the inner loop controls the column to define an empty matrix:
result =
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0]]
for i in range(3):
for j in range(4):
result [i][j] = X[i][j]+Y[x][j]