Posts

Showing posts with the label BELL:

Lecture 9 Lambda Functions, Tuples, and Lists

[SQUEAKING] [RUSTLING] [CLICKING] ANA BELL: So today, we're going to wrap up talking about functions by talking about these things called lambda functions as a way for us to create anonymous functions. And that will pretty much finish our exploration into creating functions. And the last part of the lecture, we're going to introduce new object types, tuples and lists. So let's remember what we did last time. We ended with this example. We created a function. You guys wrote it for me. And then we wrote it and debugged it together. But we created this function called apply. So what was interesting about this function is that one of its parameters was a function and the other one was an integer. And that seemed a little strange at first, but not when we realized that functions in Python are actually just objects. And so they have a name, which means that anywhere where we use other kinds of objects, like integers, floats, we can use them as parameters to function...

Lecture 7 Decomposition, Abstraction, and Functions

[SQUEAKING] [RUSTLING] [CLICKING] ANA BELL: OK. So last lecture, we started talking about the idea of decomposition and abstraction. And we talked a little bit about what that means and how it ties into what we've already been doing. Today, we're going to do a real-world example of decomposition and abstraction, and then we'll see exactly how we can achieve this in programming. So let's start by talking about an example in the real world, the smartphone. So a lot of us have it, but for a lot of us, it's really just a black box. For me, I know it is. For most of the people in the world, the phone is a black box. We basically view the phone in terms of its inputs and in terms of its outputs. So the phone has some buttons. You can scroll. You can touch things. But we don't really know exactly how all of these buttons and scrolling and all these internal workings actually do their job. And in fact, we don't need to know how they do their job. To us...

Lecture 6 Bisection Search (FIXED)

[SQUEAKING] [RUSTLING] [CLICKING] ANA BELL: OK, so let's get started on today's lecture. Last lecture I left you off with the promise of bigger and better algorithms to do what we've been trying to do, which is to approximate square roots and things like that. So today will be the introduction of our last algorithm for a bit before we'll start talking about more Python syntax. But today we're going to introduce the bisection search algorithm. OK, but before we get into that, let's try to remember where we left off last time. So last time we talked about floating point numbers and then we talked about approximation algorithms. So the reason why we talked about floating point numbers is because we wanted to come up with an algorithm that was better than guess and check. Guess and check was really limiting. We were basically limited to some exhaustive number of potential solutions. But we didn't just want to have an exhaustive set to look through ...