Track 5 · Lesson 12 of 12
Functions as values, lambda and key=
Treat functions as values you can store and pass around, write short lambda functions, and customise sorted(), max() and min() with key=.
You will be able to
- Assign a function to a variable and pass it to another function as an argument
- Write a function that takes another function as a parameter
- Write short anonymous functions with lambda
- Use key= with sorted(), max() and min() to sort and compare by a chosen property
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.