Search for tag: "int"
Lesson 24.2 The isinstance FunctionIn 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
73 plays
|
|
Lesson 24.1 Strict TypingWhenever 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
65 plays
|
|
Lesson 23.5 Mixed-Type OperatorsOperator 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
76 plays
|
|
Lesson 16.2 For-Loop DesignIn 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
97 plays
|
|
Lesson 15.2 Complex Tuple ExpressionsTuples 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
71 plays
|
|
Lesson 12.4 Functions in MemoryWe 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
85 plays
|
|
Lesson 12.1 Objects EverywhereThe 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
107 plays
|
|
Lesson 11.4 Object RepresentationWe 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
112 plays
|
|
Lesson 11.1 Objects and ClassesIn 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
155 plays
|
|
Lesson 4.6 Interactive ScriptsRight 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
107 plays
|
|
Lesson 3.1 Built-In FunctionsThe 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
158 plays
|
|
Lesson 2.4 Dynamic TypingIf 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
123 plays
|
|
Lesson 2.1 Notion of a VariableVariables 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
144 plays
|
|
Lesson 1.7 Mixed ExpressionsFor 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
178 plays
|
|
Lesson 1.3. Float ExpressionsIntegers 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
174 plays
|