Chapter 3. Container Types
Container types are used to group objects together. The main difference between the different container types is the way individual elements are accessed and how operations are defined.
A list is, as the name hints, a list of objects of any kind:
L = ['a' 20.0, 5] M = [3,['a', -3.0, 5]]
The individual objects are enumerated by assigning each element an index. The first element in the list gets index 0. This zero-based indexing is frequently used in mathematical notation. Consider the usual indexing of coefficients of a polynomial.
The index allows us to access the following objects:
L # returns 20.0 L # returns 'a' M # returns ['a',-3.0,5] M # returns 5
The bracket notation here corresponds to the use of ...