A=[[1,2,3],[4,5,6],[7,8,9]] B=[[2,3,4],[5,6,7],[8,9,1]] C=[[0,0,0],[0,0,0],[0,0,0]] for i in range(3): for j in range(3): # C[i][j]=0 for k in range(3): C[i][j]+=A[i][k]*B[k][j] print(C)