Search for tag: "accumulator"
Lesson 29.3 Generators RevisitedIn 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…
From Hannah Lee
65 plays
|
|
Lesson 28.9 Dictionary Comprehension (OPTIONAL)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…
From Hannah Lee
28 plays
|
|
Lesson28.8 List Comprehension (OPTIONAL)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…
From Hannah Lee
26 plays
|
|
Lesson 28.6 map and filterIn 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.
From Hannah Lee
52 plays
|
|
Lesson 28.5 Generator DesignNow 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…
From Hannah Lee
60 plays
|
|
Lesson 26.5 While-Loops vs For-LoopsWe 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.
From Hannah Lee
80 plays
|
|
Lesson 26.3 While-Loop RangesWhile-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.…
From Hannah Lee
81 plays
|
|
Lesson 26.2 While-Loop TracesWhile-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…
From Hannah Lee
88 plays
|
|
Zoom Oct. 27. Nested Lists and DictionariesThis 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…
From Hannah Lee
38 plays
|
|
Lesson 19.6 Immutable Dictionary FunctionsSince 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.
From Hannah Lee
73 plays
|
|
Lesson 18.5 Immutable Table FunctionsIn 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…
From Hannah Lee
80 plays
|
|
Zoom Oct. 15. For-LoopsIn 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…
From Hannah Lee
24 plays
|
|
Lesson 17.6 Divide and Conquer VisualizationJust 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…
From Hannah Lee
168 plays
|
|
Lesson 16.8 Tuple Expansion (OPTIONAL)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…
From Hannah Lee
54 plays
|
|
Lesson 16.6 Mutable For-LoopsLists 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…
From Hannah Lee
77 plays
|
|
Lesson 16.5 Positional For-LoopsSometimes 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…
From Hannah Lee
90 plays
|