Lesson 12 of 34 · Functions
Quiz: Python Functions
Functions are the backbone of every Python program. In this chapter you learned how to define them with def, why return beats print, how default values, keyword arguments, *args and **kwargs make functions flexible, and how scope, closures and lambdas let you treat functions as values.
Six questions stand between you and the chapter boss. Take your time, and read each explanation carefully — several of these details are classic interview questions.
What this quiz covers
The questions check what you learned in the Functions chapter of Learn Python. Not sure about a topic? Review its lesson first:
- Python Functions: def, Parameters and return
Define your own Python functions with def, pass parameters, return values instead of printing them, and document them with docstrings and type hints.
- Python Function Arguments: Defaults, *args and **kwargs
Learn Python default parameter values, keyword arguments, *args and **kwargs, keyword-only parameters and the mutable default argument trap.
- Python Scope, Closures and Lambda Functions
Understand Python variable scope (LEGB), global and nonlocal, closures and anonymous lambda functions — then pass functions around like any other value.
Keep learning
Need a quick reminder? The Python cheat sheet has every topic of Learn Python on one page.
Lesson last updated on .