In this video, We'll explore one more special method, underscores stir. Here is our class cash register with our special methods in it and eq, as well as, get total, add, and prove. Down at the bottom, we create three cash registers. And we print whether they are equal in various ways. Let's print cr1, and well as cr2. And see what Python produces for us. When we run it, we see output that looks a lot like what we saw in the debugger for a cash register object. We first printed what CR1 referred to, and that's a cash register object at a particular memory address that ends in 550. The object that CR2 refers to is a cash register object that a memory address that ends in C90. This might be useful for debugging, but it's not particularly useful for presenting information to a human. Function print calls underscore stir on the object that it's printing. So then let's print one for our cash register. Here's the header. Subfest equal the peremiter. For example, let's go grab a cash register. And then modify it so that all the values for loonies, toonies, fives, tens and ones are different. Now we'll call this special method. Now we need to decide what we want this output to look like. We'll say the cash register has $160 in it. We did a quick calculation off screen... And let's put in parenthesis how many loonies there are, how many two toonies there are, and so on. For the type contract, self refers to a cash register object, and this method returns a string. In fact it returns a string representation of this cash register. For the method body, well return the string CashRegister followed by a colon, a space, and a dollar symbol followed by the total amount of money in this cash register. What comes next is the number of loonies. We'll start with one and then add the number of toons and fives. Oops, I forget myself. Then comes the number of tens, and finally twenties. Last, we need a closing parenthesis. It's time to try running it and there's an error. We see here that we have a type error. We can't convert into object to Stir implicitly. The problem is that self.tens and twenties and loonies and toonies, those are all ints, and we can't add int into a Stir. That's easy to fix, although it's going to make our expression even uglier. What we need to do is convert our INTS to strings. When we try again, we find that we've forgotten one INT. The result of get_total. Run it once more, we see that we're almost there. We just need one more space after the total number of dollars. We'll add that space, run it, and it looks like we're done but wow is this ugly. We're going to introduce you to another String method that can help clean this mess up. This method is called Stir.format. It's not a special method, but it is pretty powerful. We're going to go take a look again at this output that we have in our back test, where we have CashRegister and a colon and so on. And, it would be nice to be able to base our return value, our string, on the format that we have here. And in fact, we can. Let's copy this and paste it. In order to keep the line length short, we're going to deal with the cash register part separately from the numbers. We are also want to replace these numbers with place holders that we're going to replace later with whatever values we want. These place holders are integers indicating the order in which we're going to substitute values. The substitution will be performed by method format. This first place holder should be replaced by the reuslt of self dot get total. This is the number of loonies, then toonies, fives, tens, and twenties. I hope you can see how much easier this is to read as well as to write We can comment out what we had and run it. Then we see that we have exactly the output that we used to have, but in a much cleaner fashion. Special method str is called whenever we print an object, call function str on an object, or any other time that we need a human readable version of an object.