Is an array a collection in python?

anonymity
Release: 2019-06-14 16:01:24
Original
3330 people have browsed it

There is no concept of array in Python. Array is a data structure. A collection is a data structure that contains a set of elements.

Is an array a collection in python?

Summary of data structures in Python:

In Python there are only tuples and lists;

Once a tuple is created, it cannot be changed, for example: aa=tuple(1,2,3);

Tuples cannot append (append) elements or pop (pop) Elements, etc.;

Only the elements in the tuple can be indexed aa[0], and the tuples therein cannot be assigned aa[0]=8;

The advantage of using tuples is that operating on tuples is more efficient and suitable for storing a set of constants;

While many of the above are not possible, it is possible to use a list.

For arrays:

list: array

tuple: read-only array

dict: dictionary

set: Set (can be regarded as a set in a mathematical sense)

The above is the detailed content of Is an array a collection in python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template