Welcome back everybody. At this point,
you have the machinery for extracting data
from complex nested data structures.
One of the biggest challenges is just
understanding the structure of the data you have.
Hopefully it'll have a consistent structure.
For example, if there is a list of dictionaries,
everything will be a lot easier
if all the dictionaries have the same keys.
Now once you understand the structure,
you can figure out how to write the code.
In the end, you might not need much code,
but if you try to just write it all out all at once,
it'll be very frustrating.
You'll take a long time to debug it.
So go through the understand, extract,
repeat process testing your partial code at each stage,
and you'll solve your coding problems a lot faster.
One valuable heuristic you may want to remember is that
if the data you want to access
is nested three levels deep,
a list inside a list,
inside another list, then you'll need
that same number three of extraction operations,
some combination of square brackets and for loops.
I'll leave you with a silly joke
and some serious pearls of wisdom.
Since we talked about deep and shallow copies,
what's a tiger running a copy machine called?
A copycat, of course.
Some deeper wisdom about complexity inspired by
the more complicated nested data
that we've learned how to process.
Confucius said, "Life is really simple,
but we insist on making it complicated."
Folk musician Pete Seeger said,
"Any darn fool can make something complex.
It takes a genius to make something simple."
Management guru Tom Peters,
writing about chaos in organizations said,
"If you're not confused,
you're not paying attention."
I'm not sure about that last one.
I hope you're not confused about nested data structures,
no matter how complex they get. I'll see you next time.