python study notes eleven (tuple)

Tuple
nature : an ordered set of
features :
(1) a list is very similar to
(2) can not be modified once the initialization
(3) with parentheses
create 1. tuple
format : name = tuple (a tuple element , tuple element 2, ..., tuple element n-)
(. 1) create an empty tuple
Here Insert Picture Description
(2) create a tuple, the tuple of elements with different types of elements may be
Here Insert Picture Description
element (3) is only a defined element group
Here Insert Picture Description
2 elements accessed tuple
format: tuples name [index], index starting from 0
Here Insert Picture Description
3 modified tuple
Here Insert Picture Description
4. remove tuple
Here Insert Picture Description
5. operation tuple
(1) adding the tuple
Here Insert Picture Description
(2) element group repetition
Here Insert Picture Description
(3) determining whether the element in the tuple
Here Insert Picture Description
taken (4) tuple
format: tuple name [beginning index, ending index]
from the beginning of the next subscript start capturing, taken prior to the end marker
Here Insert Picture Description
(5) two dimensional groups: a one-dimensional element is a tuple of the tuple
Here Insert Picture Description
6. tuple
(1) len () returns the number of elements in the tuple
Here Insert Picture Description
returns the maximum value tuples of elements (2) max ()
Here Insert Picture Description
(. 3) min () returns the minimum value tuple element
Here Insert Picture Description
(4) will be transformed into a list of tuples tuple (list name)
Here Insert Picture Description
(5) traversing the tuple
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/weixin_38324954/article/details/94563748