A tuple is a sequence type similar to a sequence, except that once created, it cannot be changed, so a tuple can be thought of as an immutable list.

Tuple generation and basic operations

Python generates tuples with a pair of parentheses (), separated by commas

For tuples with two or more elements, you can omit the parentheses when constructing them

Tuples can also be indexed and sliced to view elements

Cannot be modified

2 Tuples containing only a single element

Since the parentheses’ () ‘have special meaning in expressions, for tuples containing only a single element

The 3-tuple method

Since tuples are immutable, he only supports. The count (), the index () method

Conversions between lists and tuples

Lists and tuples can be converted to each other using the tuple() and list() functions

List vs. tuple generation speed comparison

Immutability of tuples

After you create a tuple, you cannot change the shape of the tuple or re-create an element of the tuple

Assignment, however, is not absolute if the element in the tuple itself is mutable &