A Python list is an object that comprises one or more elements; it is similar to an array in C or Java. Lists are ordered and use zero-based indexing (i.e., the first element of a list is numbered zero). A list is called iterable because it can provide successive elements on each iteration through a looping control structure such as for; see page 572 for a discussion.
This section shows one way to instantiate (create) a list. The following commands instantiate and display a list named a that holds four values:
>>> a = ['bb', 'dd', 'zz', 'rr']>>> a['bb', 'dd', 'zz', 'rr']
You can access an element of a list by specifying its index (remember—the first element of a list is numbered zero). The first of the following commands displays ...