Python 3.x 请给我解释一下python中关于矩阵的代码

Python 3.x 请给我解释一下python中关于矩阵的代码,python-3.x,Python 3.x,嘿,我试着写一个程序来找到两个矩阵a和B的和,并将和存储在另一个矩阵C中,但是我没有得到这个用for循环声明矩阵的代码 r = int(input('Enter no. of rows of matrix A')) c = int(input('Enter the number of colm. of matrix B')) r1 = int(input('Enter the number of rows of Matrix B')) c1 = int(input('Enter the numb

嘿,我试着写一个程序来找到两个矩阵a和B的和,并将和存储在另一个矩阵C中,但是我没有得到这个用for循环声明矩阵的代码

r = int(input('Enter no. of rows of matrix A'))
c = int(input('Enter the number of colm. of matrix B'))
r1 = int(input('Enter the number of rows of Matrix B'))
c1 = int(input('Enter the number of colm. of Matrix B'))
#declaring  of matrices
A = [[0 for x in range(c)]for x in range(r)]
B = [[0 for x in range(c1)]for x in range(r1)]

阅读Python中的
列表理解
。类似于此的问题解释了如何从列表列表到numpy数组/矩阵:阅读Python中的
列表理解
。类似于此的问题解释了如何从列表到numpy数组/矩阵: