python创建矩阵_在Python中创建矩阵的Python程序

python创建矩阵

There is no specific data type in Python to create a matrix, we can use list of list to create a matrix.

Python中没有特定的数据类型来创建矩阵,我们可以使用list列表来创建矩阵

Consider the below example,

考虑下面的示例,

mat = [
  [10, 20, 30],
  [40, 50, 60],
  [70, 80, 80]
]

It can be considered a 3x3 matrix, there are 3 rows and 3 columns in 'mat' matrix.

可以认为是3x3矩阵,“ mat”矩阵中有3行3列。

访问矩阵元素 (Accessing matrix elements)

Just like matrix in C/C++, we can access the elements in Python also.

就像C / C ++中的矩阵一样,我们也可以访问Python中的元素。

Consider the below program,

考虑下面的程序,

# Python matrix creation
mat = [
  [1

你可能感兴趣的:(列表,python,numpy,机器学习,anaconda)