Flattening Lists
Learn how to shift from a fully recursive solution to a less recursive solution.
We'll cover the following...
Fully recursive solution
Consider this list:
[1, [2, 3], 4, [[5, 6], 7]]
This list contains a mixture of integers and lists. These lists can also contain a mixture of integers and lists, and, in fact, the whole thing can be nested to any depth. You want to flatten this into a single list containing all the integers in the order they occur in the original unflattened list, as shown here:
[1, 2, 3, 4, 5, 6, 7]
...Access this course and 1400+ top-rated courses and projects.