Module 12
Lambda and Special Functions
Learn anonymous functions and important functional-programming helpers.
01
Lambda and Special Functions — Why filter, map, and reduce need callbacks
Meet filter, map, and reduce as special functions, see why they need a FunctionName, and how lambda is the usual instant callback in this lab.
02
Lambda Instant Operations — Named, Inline, and Callbacks for Special Functions
Reuse lambda as the FunctionName for special functions: named vs inline, implicit return, ternary max, and a lambda that calls a def helper.
03
Python filter() Deep Dive — Keep Values that Return True
Build filter() three ways: a def predicate, a named lambda, and an inline lambda. Extract positives, palindromes, and 3-to-4 letter words.
04
Python map() and zip() — Transform Lists and Pair Results
Use map() to hike salaries and square values, map two lists with a two-parameter lambda, pad unequal lengths with 0.0, and print columns with zip().
05
Python reduce() Deep Dive — Accumulate One Result with functools
Import functools.reduce, walk the four internal steps, then fold lists into a sum, max, min, or a single concatenated line of words.
06
Filter → Map → Reduce Pipeline — Positive Sums and Salary Bands
Chain filter, map, and reduce like the combo examples: sum positives and negatives, then hike two salary bands at 10% and 20% and total each band.