list

An ordered, changeable collection of values written in square brackets, such as [3, 1, 4].

In more detail

Lists can hold any mix of types, grow with append, and be indexed, sliced and looped over. They are mutable, so two names for one list both see a change. Because they can change, lists cannot be dictionary keys or set members; use a tuple for that.

Example

nums = [3, 1, 4]
nums.append(1)

Related terms

Taught in

References

Certification courses