[Zero-basic learning Python note 012] an array of hormones 3 illustration
List Operators
Comparison operator logical operator join operator repeat operator member Operator
+ Indicates two connections; * Indicates replication.
The types of "+" in list must be consistent.
Example:
Note:: You can use append () or insert () to add elements ()
In and not
The method for viewing an element that is not in the list: in and not in; the method for viewing the list in the list is similar to the method for accessing elements in a two-dimensional array in C language.
Example:
List of friends
Count () is used to count
Index () is used to find the location. It can be a parameter or three parameters. The first parameter indicates the element to be searched, and the second parameter indicates the start position, the third parameter indicates the termination position.
Reverse () is used for elements in the inverted list.
Sort () is used to sort list elements. By default, it is sorted from small to large. To be large to small, use sort () and reverse (). In this case, we can use sort () to re-write the power. At this time, it has three parameters, the first two are default, and the third is reverse = False. We can change it to reverse = True, that is, sort (reverse = True)
Example:
The difference between copying part lists and directly using "=" is that Python variables are like a label, just a name, and where they are stored.
Example:
The above examples are illustrated;