We'll look at a number of built-in and standard library collection types. These collections offer more features than the simple tuple collection. We'll look at the for
and while
statements which allow us to process the individual items of a collection.
We'll look at some functions which we can use to work with collections of data; these include the map()
, filter()
, and functools.reduce()
functions. By using these, we don't need to write an explicit for
statement to process a collection. We'll also look at more specific kinds of reductions such as max()
, min()
, len()
, and sum()
.
We'll also look at the break
and continue
statements; these modify a for
or while
loop to allow skipping items or exiting before the loop has processed all items. This is a fundamental change in the semantics of a collection-processing statement.
The concepts of mutability and immutability are part of understanding how an object behaves. The built-in types in this chapter are all mutable...