We continue our discussion on recursion, getting into more details:

• What happens in memory when we execute a recursive function? The call stack grows with each recursive call, until a base case is reached and the call returns. All the calls eventually wrap up, accumulating the final result.
• There are different ways to break up the problem into parts, but you need to make sure that each part will progress to the base case eventually and that the answers from the parts are combined correctly.
• Recursion and objects

### Lecture Prep

Re-read: the function deblank from last lecture.
Then visualize its execution given these function calls:
• deblank('ab')
• deblank('a b')
• deblank(' a b c')

You can use Python Tutor, but do not just watch Python Tutor work passively. You need to predict how Python will execute the next statement before you click forward on Python Tutor. It's ok if your prediction isn't perfect right now; you just need to really try it for yourself to think through the process. We will do more during lecture to build your understanding of recursion.

### Lecture materials

Slides: individual slides for viewing , 6-up layout for printing

Examples: factorial.py (from previous lecture), stringExamples.py , family.py (skeleton), person.py (module to provide ``` Person ``` instances--you don't need to understand or even read person.py)
To download the above .py files, right-click (Windows) or command-click (Macs) on the filename and then select "Save link as".
This way you choose where the files will be saved, instead of having your computer save to the default folder (from which you will later have to move your files for organization).

Optional practice: The final lecture slide lists an optional practice question ``` list_ancestors ``` related to the lecture example ``` num_ancestors ``` . Implement it yourself in this incomplete module family.py (same skeleton file as that posted above). After you have implemented it, you can take a look at our solution