Search for tag: "values"

Lesson 21.4 Invariant Enforcement

We know how to enforce preconditions, but how do we force invariants for our attributes? As we see in this video, we do it much the same as for preconditions. But that is because we are going to…

From  Hannah Lee on October 30th, 2020 50 plays

Lesson 21.2 Interface Design

When designing a class, we need to come up with the interface first. In this video we talk about how to do that. We approach this problem returning to our understanding of types: a collection of…

From  Hannah Lee on October 30th, 2020 43 plays

Lesson 20.9 Optional Arguments

Unlike other programming languages, a Python class has only one constructor, If we want to give the user more flexibility when creating objects, we should make certain arguments optional. In this…

From  Hannah Lee on October 27th, 2020 32 plays

Lesson 19.7 Mutable Table Functions

Dictionaries are mutables and support mutable functions. But this is a case where dictionaries are slightly different from lists. We are allowed to loop over a dictionary as we modify it, so long as…

From  Hannah Lee on October 27th, 2020 29 plays

Lesson 19.5 Dictionaries and For-Loops

Dictionaries are not sliceable, but they are iterable. In this video we show the many different ways you can use a dictionary in a for-loop. The primary thing to understand is that you have to…

From  Hannah Lee on October 27th, 2020 33 plays

Lesson 19.4 Nested Dictionaries

In this video we show that we can nest dictionaries just like we nested lists. In fact, a lot of real world data is represented this way. We show off a particularly complicated JSON file that…

From  Hannah Lee on October 27th, 2020 25 plays

Lesson 19.3 Dictionary Visualization

Since dictionaries are mutable, we must represent them with folders. In this video we show what these folders must look like. In doing so, we see that they look suspiciously similar to other folders…

From  Hannah Lee on October 27th, 2020 27 plays

Lesson 19.2 Dictionary Assignment

Dictionaries are mutable. In this video we show how to alter there contents. This includes reassigning the value of a dictionary for a given key. But it also includes adding and deleting keys.

From  Hannah Lee on October 27th, 2020 26 plays

Lesson 19.1 Dictionary Expressions

In this video, we introduce a dictionary as a collection of key-value pairs. We also show how to write a dictionary expression in Python. It looks just like a JSON string, but without the quotes.

From  Hannah Lee on October 27th, 2020 30 plays

Lesson 16.2 For-Loop Design

In this video we show how to use for-loops in function definitions. In particular, we show that we go from a specification to code that uses a for-loop.

From  Hannah Lee on October 19th, 2020 28 plays

Lesson 15.2 Complex Tuple Expressions

Tuples are very, very similar to strings. In this video we explore this similarity, showing that they support many of the same operations and methods.

From  Hannah Lee on October 10th, 2020 15 plays

Lesson 11.6 Attribute Invariants

When you work on Assignment 3, you will discover that the color objects have some significant restrictions on how they can be used. These restrictions are called attribute invariants, and they are…

From  Hannah Lee on October 2nd, 2020 7 plays

Lesson 11.1 Objects and Classes

In this video we have to introduce some new terminology. We talk about classes, which are new types that are provided by modules (and therefore not built into Python). Objects are the values for…

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 6 plays

Lesson 7.4 Preconditions Categories

In this video, we break our preconditions up into categories. The primary reason for this is to help us analyze a specification. It will also become extremely imporant when we talk about enforcement…

From  Hannah Lee on September 24th, 2020 5 plays