6.100L | Fall 2022 | Undergraduate

# Introduction to CS and Programming using Python

## Lecture 16: Recursion on Non-Numerics

Topics: Recursion: Fibonacci, Fibonacci with a dict, recursion on non-numerics, recursion on lists, Towers of Hanoi (extra)

### Lecture Notes

Lecture 16: Recursion on Non-Numerics

Lecture 16 Code

Ch 6.2–6.4

### Finger Exercise Lecture 16

Implement the function that meets the specifications below:

``````def flatten(L):
"""
L: a list
Returns a copy of L, which is a flattened version of L
"""

# Examples:
L = [[1,4,[6],2],[[[3]],2],4,5]
print(flatten(L)) # prints the list [1,4,6,2,3,2,4,5]
``````

6.100L Finger Exercises Lecture 16 Solutions

### Problem Set 4

Problem Set 4

Problem Set 4 Code

### Recitation 8

Recitations were smaller sections that went over the previous lectures. Files contain recitation notes and worked examples in code.

Recitation 8 Notes and Code

## Course Info

Fall 2022
##### Learning Resource Types
Lecture Videos
Lecture Notes
Problem Sets
Programming Assignments with Examples