Python Quest

Track 12 · Lesson 10 of 12

Functional tools

Work with functions as building blocks: map and filter versus comprehensions, sorting with keys, the operator module, functools.partial and reduce, any/all and zip(strict=True).

About 45 minIntermediate4 exercises

You will be able to

  • Choose between map/filter and comprehensions for readable transformations
  • Sort and pick records with key functions, including operator.itemgetter and attrgetter
  • Pre-fill arguments with functools.partial and combine values with functools.reduce
  • Use any() and all() correctly, including on empty input
  • Pair sequences safely with zip(strict=True)

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.