Search for tag: "return"

Lesson 29.4 The yield Statement

While generators are coroutines, the communication only goes one way: from the child to the calling parent. In this video we show how to reverse this communication, passing down information from the…

From  Hannah Lee on December 3rd, 2020 0 plays

Lesson 29.3 Generators Revisited

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…

From  Hannah Lee on December 3rd, 2020 0 plays

Lesson 28.4 Generator Visualization

Generators look like normal functions, but they do not behave like them. In this video we show how to visualize them, using the Python Tutor.

From  Hannah Lee on December 3rd, 2020 3 plays

Lesson 28.3 The yield Statement

Making iterator classes is hard. In this video, we show an alternative, allowing us to write the iterator as a ‘function”. This requires the addition of a new python statement, the yield…

From  Hannah Lee on December 3rd, 2020 3 plays

Lesson 20.7 Intializers

In this video, we introduce the most important method definition in any class: the initializer. The initializer is responsible for creating all the attributes so that the user does not need to worry…

From  Hannah Lee on October 27th, 2020 39 plays

Lesson 17.6 Divide and Conquer Visualization

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…

From  Hannah Lee on October 19th, 2020 42 plays

Lesson 17.2 Recursive Functions

In this video we show how to take recursive definitions from mathematics and implement them in Python. To do this, we will need to have a function call itself in its own definition.

From  Hannah Lee on October 19th, 2020 41 plays

Lesson 16.7 For-Loops and Testing

Another control-structure means another video on testing. But if you have following the Rule of Numbers, you will discover that you have enough tests for your for-loop. Instead, as we show in this…

From  Hannah Lee on October 19th, 2020 23 plays

Lesson 15.7 Mutable List Functions

Because lists are mutable, just like general objects, we can modify them in the body of a function. In this video we show how to write mutable list functions, which are (typically) procedures that…

From  Hannah Lee on October 10th, 2020 16 plays

Lesson 12.7 The Call Stack

In this video we look at the call stack in much more detail. In particular, we see that is possible to have more than one call frame active at a time, and the stack is the way these frames are…

From  Hannah Lee on October 2nd, 2020 13 plays

Lesson 12.6 Global Variables

With both modules and function definitions, we saw that global variables are incredibly important. But most of our code is inside of function definitions, and therefore executed inside of call…

From  Hannah Lee on October 2nd, 2020 11 plays

Lesson 11.7 Mutable Functions

In the past if we wanted to do any significant computation, we needed a a fruitful function. Procedures are limited to testing or printing stuff out on the screen. But in this video we show how we…

From  Hannah Lee on October 2nd, 2020 8 plays

Lesson 11.4 Object Representation

We have said that objects are essentially folders? But the command line cannot display these folders using text. In this video, we talk about what the command line does show when we look at an object…

From  Hannah Lee on October 2nd, 2020 8 plays

Lesson 10.4 Iterative Testing

We made very sure that you had learned about testing before you started on your first assignment. That is because we want you testing while you are activtely writing your code, and not waiting until…

From  Hannah Lee on October 2nd, 2020 3 plays

Lesson 9.6 Conditionals & Call Frames

Conditionals are typically used inside of function definitions. So how do they affect the way that we draw call frames. We address this issue in this video. You should pay close attention to the…

From  Hannah Lee on September 24th, 2020 7 plays

Lesson 8.1 Testing Plans

Before you start testing, you must have a testing plan. In this video we explain what these are, and how they fit into the software development process.

From  Hannah Lee on September 24th, 2020 9 plays