Search for tag: "statements"

Lesson 26.2 While-Loop Traces

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…

From  Hannah Lee on November 12th, 2020 4 plays

Lesson 26.1 The While-Loop

In this video we talk about the while-loop and explain why it is necessary. In particular, there are types of iteration that are not possible with the for-loop.

From  Hannah Lee on November 12th, 2020 6 plays

Lesson 25.4 The raise Statement

Up until now, the only way that we knew how to create an error is with an assert statement. But these always create errors with the type AssertionError. In this video we show how to create errors…

From  Hannah Lee on November 12th, 2020 29 plays

Lesson 25.3 Error Types and the Call Stack

After the last video, try-except looks less like an if-else statement and more like an if-elif-else statement. As we see in this video, this has profound effects on how errors interact with the call…

From  Hannah Lee on November 12th, 2020 32 plays

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 20.3 Classes and Attributes

The primary role of an object is to store attribute variables. In this video we demonstrate the easiest way to add attributes to an object. We see that we can also add attributes to class folders as…

From  Hannah Lee on October 27th, 2020 37 plays

Lesson 20.1 Class Definitions

In this video we show you the basic format of a class definition. However, classes can contain a lot of features, so our classes will be very simple for this demonstration.

From  Hannah Lee on October 27th, 2020 38 plays

Lesson 16.1 The For-Loop

In this video we introduce a new control-structure: the for-loop. This control structure is specifically designed for processing iterable types like strings, tuples, and lists.

From  Hannah Lee on October 19th, 2020 29 plays

Lesson 14.3 Try-Except and the Stack

The except-portion of an try-except statement is only executed when there is an error/crash. But, as we have seen, errors can occur anywhere in the call stack. In this video we show how try-except…

From  Hannah Lee on October 10th, 2020 16 plays

Lesson 13.5 Assert Trade-Offs

Preconditions can get really complicated, and sometimes it is unclear how to enforce all of the preconditions. In this video we talk about why it is okay to break up a precondition and…

From  Hannah Lee on October 10th, 2020 11 plays

Lesson 13.4 Assert Messages

We now know how to do assert statements to create errors. But the error messages are a little cryptic. In this video we talk about how we can do a better job.

From  Hannah Lee on October 10th, 2020 12 plays

Lesson 10.7 Multifunction Debugging

Top-down design simplifies the design of code, but it can make debugging a little more complicated. Now bugs are potentially spread across multiple functions. In this video we look at an extended…

From  Hannah Lee on October 2nd, 2020 3 plays

Lesson 10.6 Top-Down Design

Top-down design is a widely–used design technique. Your instructor used it to design the first assignment, and you will use it yourself in later assignments. In this video we take a closer look…

From  Hannah Lee on October 2nd, 2020 3 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 10.3 PseudoCode

In this video we introduce pseudocode, which is a step-by-step English description of what we want to do. The goal is provide an outline that we convert into Python later.

From  Hannah Lee on October 2nd, 2020 2 plays

Lesson 9.9 Tracing Conditionals

Now that program structure and program flow are different, debugging is going to get a lot harder. In this video we introduce a new element of white box testing – the trace. You will need to…

From  Hannah Lee on September 24th, 2020 4 plays