The next four types described (
tuple) are collectively referred to as
Each sequence value represents an ordered set in the mathematical sense, that is, a collection of things in a specific order.
Python distinguishes between mutable and immutable sequences:
An immutable sequence can be created or destroyed, but the number, sequence, and values of its elements cannot change.
The values of a mutable sequence can be changed. Any element can be replaced or deleted, and new elements can be added at the beginning, the end, or in the middle.
There are four sequence types, but they share most of the same operations.
Section 9, “Type
str: Strings of 8-bit
Section 11, “Type
list: Mutable sequences” (mutable).
Section 12, “Type
tuple: Immutable sequences” (immutable).