Skip to main content
Loading page…
Python Mastery
Chapter 6
Lesson 4 of 4
Recursion & Lambdas
Contents
Notes
Tutor
Concept
Recursion: Base Case + Recursive Case
Loading activity…
Previous
1 / 8
Continue
Contents
Notes
Discussion
Tutor
28 min
8 activities
0 of 8 done
In this lesson
1
Recursion: Base Case + Recursive Case
2
Recursion Limits & When to Prefer Iteration
3
Worked Example: Recursive Sum of a Nested List
4
Lambda Expressions
5
Practice: Recursive Power Function
6
Practice: Sort with Lambda
7
Pitfall: Missing or Wrong Base Case Causes Infinite Recursion
8
Tip: operator.itemgetter / attrgetter as Faster Alternatives to Lambda
Objectives
Learner can write a correct recursive function that includes a base case and recursive case
Learner can trace recursive call stacks for factorial and Fibonacci
Learner can explain recursion limits and convert simple recursion to iteration
Learner can write and use lambda expressions for sorting and functional patterns
Chapter 6 · Functions
Defining & Calling Functions
Arguments In Depth
Scope: The LEGB Rule
Recursion & Lambdas
Previous: Scope: The LEGB Rule
Next: The Import System