 a function in Python. So here we are on Sage Math Cell. Let me run it in Python. So if I want to create a function, like say let's take a function that takes any number, squares it and multiplies by seven. So the way to find a function in Python is with the command death for define. And I need to give the function a name. Let's call this, let's just call it my function. It can be any, any name you want essentially. And we have to say what input we want. So the input, I'll just call the input x. You can give it any particular name you want. Now we have to define what the operation is going to be. So let's say output is equal to, let's see, I want to take the number x and square it and then multiply it by seven. So once you do the other whatever operations you want to do, and create an output, we have to give that output back to the user. The keyword for that is return. So for example, I can not write my function of 100. Let's print the output. I can do print my function of 10 or five. Now, now that we have a function, we can actually do all sorts of things. Like so for example, suppose I want to take all the numbers between one and 20 and apply my function to them. So let's say L is equal to range 21, or say 121. And let's make that into a list. Okay, numbers from one to 20. And now I'm going to say, let's say L2 is, I can do this as saying my function of what do you want to call it, t for t in L. So here I've used list comprehension using the function we defined to apply it to a whole range of numbers. For our purposes, this is useful particularly for matrices. So for example, let's do a function that say squares matrix. So let's assume that a is square. So let's check that a is square first of all because you can't apply it. I want to return the matrix a times a or rather a dot a in the notation of numpy. But that doesn't make sense if the sizes of a don't match. So you might want to say, let's have m and n be the shape of a. And here's a quick way to check things. You can say assert m is equal to n. So now let me say, let's say, let's make a matrix. Let's call it b. Doesn't matter what you call, of course, the variable a is only defined inside this command, right? This a has nothing to do with any a's I got here. Now what if our matrix weren't square? Let me remove a row so that its sizes don't match. So notice what happened here is I wrote I have this matrix which is two by three. Of course, I can't square a two by three matrix. So when I attempt to do this operation, notice what happens is that we've taken a dot shape, which is two comma three, and we've checked that those numbers, so m and n would be two and three there, are equal. And when that fails, we get what's called an assertion error. And the assertion error is sorry your sizes don't match. And it tells us actually exactly in the code where that has happened. So that's a quick rundown on how to define a function with def and then return. And you can do any operations you want on the inside and how to apply that either to lists or to other types of operations and also to catch error messages.