|
In the previous video, we said that generators are a type of coroutine. In this video, we explore this idea. We use yield statements to write generators that are a little more sophisticated than…
|
|
This video is not optional because the material is advanced. It is optional because this video series has run long and this topic is less important for you to know. While we have not talked about…
|
|
This video is not optional because the material is advanced. It is optional because this video series has run long and this topic is less important for you to know. When we are done with out…
|
|
In this video we talk about two very famous generators: map and filter. We show how to use these to replace writing code with a for-loop.
|
|
Now that we know how generators work, it is time to write our own. In this video we show how easy it is. We just take out experience with the accumulator pattern and replace the accumulator with a…
|
|
We can always replace for-loops with while-loops, but should we? In this video we talk about the trade-offs of the two control structures and why it might be better to use over the other.
|
|
While-loops require additional patterns beyond the simple accumulator pattern that we used in for-loops. In this video, we talk about the first such pattern, which is replacing the range iterator.…
|
|
While-loops can do everything that a for-loop can (and more) but they are much harder to use. That is why, in this video, we talk about how to debug a while-loop before we talk about how to write…
|
|
This presentation explores the last built-in (as opposed to user-defined) types in this course. These types are often used to store data in files.We actually had an (accidental) sneak peak at these…
|
|
Since we can loop over dictionaries, that means we probably want to use them in functions with accumulators. In this video we show how to do this and why they are not that much different from lists.
|
|
In this video we show how to write an immutable function on a table of data. In most ways this is no different than writing an immutable function on a list. Except that this time we may need multiple…
|
|
In this session, we review the for-loop, which is the next control structure. This is the last control structure we will need for a while.For-loops are pretty easy to use in Python, and most students…
|
|
Just because you know how to write a divide-and-conquer algorithm does not mean you understand it. In this video we try to improve our understanding by visualizing divide-and-conquer. When we do this…
|
|
This video introduces an advanced topic that is completely optional and will not appear on any exam. You might have noticed that some functions, like max can take an arbitrary number of arguments. In…
|
|
Lists are mutables and support mutable functions. Many of these mutable functions contain for-loops. As we show in this video, this changes how we write the for-loop. In particular, we will not use…
|
|
Sometimes we need to perform a calculation on a string, list, or tuple, but we do not want to loop over this value. Instead, we want to loop over the positions of the value. In this video we show why…
|