Built-in data structure for python learning

Classification
1. Numerical
int: The int of python3 is a long integer, which has no size limit and is limited by the size of the memory area.
float: consists of a real part and a fractional part, and supports decimal and scientific notation representation.
complex: complex number, consisting of real and imaginary parts, whether the real and imaginary parts are floating-point numbers, for example: 3+4J
bool: a subclass of int, with only 2 instances, True, False correspond to 1 and 0, both Can operate directly with positive numbers.
2. Sequence object
string str:
list
is an ordered queue whose elements can be any object, supports slice operations, and is a linearly variable data structure, represented by [].
List query:
index(value,[start,[stop]]), find whether the elements in the list match through the specified interval, and return the index immediately if the first match, if not, an exception will be thrown ValueErro
cout(value): return The number of times the value is matched in the list
Time complexity: The index and count methods are both O(n), and the efficiency decreases as the size of the list data increases.
len(): returns the number of elements in the list

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325197029&siteId=291194637