Search for tag: "int"

Lesson 24.2 The isinstance Function

In this video, we show that we can solve the problem of strict typing by using the isinstance function. This function will be our preferred way for enforcing preconditions going forward.

From  Hannah Lee 69 plays

Lesson 24.1 Strict Typing

Whenever we have enforced preconditions, we have always used the type function. In this video we show why that is a problem, particularly when we want to use an object argument that is a subclass of…

From  Hannah Lee 60 plays

Lesson 23.5 Mixed-Type Operators

Operator overloading allows us to redefine the meaning of + or * on objects of our class. But sometimes we want to mix together types like a fraction and integer. In this video we show that it is…

From  Hannah Lee 70 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 90 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 62 plays

Lesson 12.4 Functions in Memory

We know what happens when we call a function. But as we show in this video, Python also does something very important when we define a function. It has to store the definition somewhere.

From  Hannah Lee 79 plays

Lesson 12.1 Objects Everywhere

The biggest lie that we have told is that there is a difference between classes and the basic types. In this video we show that this is not true, and what ramifications this has for Python.

From  Hannah Lee 95 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 103 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 136 plays

Lesson 4.6 Interactive Scripts

Right now, we do not know a lot of Python commands, and so our scripts are pretty boring. But we can make them a lot more interesting with a function that we have already seen: the input function. In…

From  Hannah Lee 96 plays

Lesson 3.1 Built-In Functions

The easiest functions to use in Python are those that are built into it. They are listed on the Python Documentation page. In this video we examine some of these and show the syntax for how to use…

From  Hannah Lee 137 plays

Lesson 2.4 Dynamic Typing

If you have programmed before (and it is okay if you have not), you may be used to variables having the restriction that they can only contain specific types. This is not the case in Python, and that…

From  Hannah Lee 111 plays

Lesson 2.1 Notion of a Variable

Variables are tricky things because they are often invisible. To better understand them, we need to build a mental model of how they work. That is the purpose of this video.

From  Hannah Lee 128 plays

Lesson 1.7 Mixed Expressions

For the most part, operations are used to combine two expressions of the same type. Adding together two ints is different from adding together two strings. In this video we see what happens when we…

From  Hannah Lee 157 plays

Lesson 1.3. Float Expressions

Integers are not the only number type in Python. There is also the float type, which is the set of real numbers. Floats can do just about everything that integers So why then does Python need a…

From  Hannah Lee 161 plays