Current location - Training Enrollment Network - Mathematics courses - The difference between list and array in python
The difference between list and array in python
In Python, both list and array can get elements according to the index, but list can add elements or add arrays with append or+,but array can't. The specific differences are as follows:

1, different functions

A list is a data structure that handles an ordered set of items;

Array stores multidimensional arrays with a single data type;

2. Built-in data types

List is Python's built-in data type;

The Array array needs to be imported into the standard library, which is not a built-in type;

3. Are the data types the same?

The data classes in the list need not be the same, that is, each element can be a different data type;

Array is encapsulated by Numpy, and the stored elements are of the same data type;

Step 4 operate

List list cannot perform four mathematical operations;

Array array can perform four kinds of mathematical operations;