矩阵乘法

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)

 

posted @ 2020-12-30 16:42  Wangtn  阅读(84)  评论(0编辑  收藏  举报