Functions
12 Topics
1
Function Basics
Defining and calling functions, the foundation of Python programming
Fundamental concept tested in virtually all Python interviews
2
Parameters and Arguments
Positional, keyword, default, and keyword-only arguments
Critical for interviews — mutable defaults is one of the most asked Python questions
3
Return Values
Returning single and multiple values, early returns, and None handling
Core function design — multiple returns and early returns are common interview patterns
4
*args and **kwargs
Variable-length positional and keyword arguments
Very common in interviews — essential for decorators, wrappers, and flexible APIs
5
Variable Scope
Local, global, nonlocal scope and the LEGB rule
Common interview topic — LEGB rule and closure scoping are frequently tested
6
Recursion
Functions calling themselves with base cases and memoization
Extremely common in interviews — tree traversal, divide-and-conquer, and dynamic programming
7
Lambda Functions
Anonymous inline functions for concise functional expressions
Common in interviews — sorting with custom keys, map/filter, and callback patterns
8
Closures
Functions that capture and remember their enclosing scope variables
Advanced concept frequently tested — basis for decorators, callbacks, and stateful functions
9
Decorators
Modifying function behavior with wrapper functions and @ syntax
Very important for interviews — used in web frameworks, caching, auth, and logging
10
Higher-Order Functions
Functions that take or return other functions
Key functional programming concept — tested in map/filter/reduce and callback patterns
11
Docstrings
Documenting functions with structured docstring formats
Expected in production code — tested in code review and documentation interviews
12
First-Class Functions
Functions as objects that can be assigned, passed, and stored
Core Python concept — underpins decorators, callbacks, and functional programming