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

Lecture Prep

Re-read: the function deblank from last lecture.
Then visualize its execution given these function calls:

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

Questions and Answers: check the answers after you try them on your own!

Link to Lecture Recording