请向我解释这段关于python中矩阵的代码

时间:2019-03-25 04:26:24

标签: 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 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)]

0 个答案:

没有答案