📜  如何在 python 代码示例中获取矩阵输入

📅  最后修改于: 2022-03-11 14:46:44.225000             🧑  作者: Mango

代码示例3
row=int(input("Enter number of rows you want: "))
col=int(input("Enter number of columns you want: "))
mat=[]
for m in range(row):
  a=[]
  for n in range(col):
     a.append(0)
  mat.append(a)

for i in range(len(mat)):
  for j in range(len(mat[0])):
    mat[i][j]=int(input("Input element: "))
print("Your Matrix is :",mat)