December 2021
Beginner
840 pages
47h 29m
English
As in Scheme, but unlike in ML and Haskell, lists in Python are heterogeneous, meaning all elements of the list need not be of the same type. For example, the list [2,2.1, "hello"] in Python is heterogeneous while the list [2, 3, 4] in Haskell is homogeneous. Like ML and Haskell, Python is type safe. However, Python is dynamically typed, unlike ML and Haskell. The semantics of [] is the empty list. Tuples (Section A.6) are more appropriate to store unordered items of different types. Lists in Python are indexed using zero-based indexing. The + is the append operator that accepts two lists and appends them to each other.
Examples:

Read now
Unlock full access