Exercises
If you haven't encountered with
 statements and context managers before, I encourage you, as usual, to go through your old code, find all the places where you were opening files, and make sure they are safely closed using the with
 statement. Look for places to write your own context managers as well. Ugly or repetitive try...finally
 clauses are a good place to start, but you may find them useful any time you need to do before and/or after tasks in context.
You've probably used many of the basic built-in functions before now. We covered several of them, but didn't go into a great deal of detail. Play with enumerate
, zip
, reversed
, any
, and all
until you know you'll remember to use them when they are the right tool for the job. The enumerate
 function is especially important because not using it results in some pretty ugly while
 loops.
Also explore some applications that pass functions...