Len and Sum

Learn how to reduce iterables using the "len" and "sum" functions.

We'll cover the following

Reducing functions

In the earlier chapter on Iterators, we divided the built-in iterator functions into groups:

  • Transforming functions
  • Reducing functions
  • Converting functions
  • Primitive functions

In this chapter, we will cover the reducing functions.

A reducing function takes all the values from an iterable and reduces them to a single representative value. For example, sum adds all the values in an iterable and returns the total value.

Get hands-on with 1200+ tech skills courses.