 Okay, functions and arguments, functions are really cool. But wouldn't it be cooler if you could use a function in a functions argument? What do we mean by that? So let's say we were going to do something like this def test. And then in here, we would do something like depth test two or test one or whatever we wanted to do, not exactly how we're going to do it. But yes, we are going to use functions as arguments. Let's dive in and take a look. Let's dive right in here, we're going to look at a function in an argument. That sounds a little squirrely, but let's take a look here. So I'm going to say def test. And we're going to have some parameters here. I'm going to say name, age, and pets. We've seen that kind of before in a previous video. Go ahead and print these out. Some say print, do the magic copy and paste. We can speed this process up just a little bit. This is going to be a super, super simple little function here. So we're just going to print out name, age pet. There was vastly easier ways we could have done that. But I just want to really print that out one line at a time using the information we've learned so far. So from here, we're going to make another function called get data. And this is pretty common, not just in Python, but pretty much every programming language out there where you'll have one function that returns some type of data and another function that actually does something with the data. So here we're going to return a dictionary using the, well, same kind of data pattern here. Some say, Brian, enter whatever age you want. I won't tell anybody if you enter, you know, something much younger or older. If you're into that, I don't know. So just going to return a dictionary of name, age, and pet. Now we have some fundamental problems here. For example, how do we actually use these two together? Well, there's the standard way, as I call it, which you would just call this standalone get data. But now you have to feed it in like this test. And you have to do this really long, annoying, you got to get the order right and all this other fun stuff, which is really not that fun at all. And you can do that all day long. And of course, if you change one thing, you've got to change everything else and it becomes just a real nightmare, but it does work. You know, we did look at an easier way with packing data or unpacking data, I should say, I'm going to say test. And now we're going to call get data. But there's a fundamental problem here. If we call it like this, and we're actually calling that function, we are returning a dictionary, but now we need to unpack it. Example, if I just run it, it's going to say missing two required positional arguments, age and pet. So now let's just go ahead and tell Python to unpack that. Save and run. But now it works. And it's very simple, very easy. You can do it all in one line. Super cool the way that works. Okay, so we're going to cover something a little different. It's a function as an argument. We've already covered a function in an argument right here, where we said test. And then we've called get data with these parentheses and we had to unpack it. And we've got all these special characters in the special order that we got to get just right or nothing works. We're going to do something a little bit easier. I'm going to say def. And I need a good name. Let's call it funky. Why not? I don't know what name to give it. So we're going to call it funky. And we're going to have a variable called data. So far, everything's very abstract. Nothing's really defined, we just have a variable called data. And we're going to make another variable called D. And it's going to be the result of data. Notice how data is being called like a function, even though it's also a variable. Other languages, you call that like a function pointer. But basically what's going on is we're saying grab some function and then call it doesn't matter what we name it, we could name this kittens. And then D is going to be the result of kittens. The name really isn't matter. What matters is we are going to call this as a function and Python is smart enough to know, Hey, that variable is a function pointer under the hood, do something with it. So we're going to go ahead and print out D. Now to do this, I'm going to say funky. And we're going to reuse our get data function from up here, which is just going to return a dictionary object. So here is the important bit, I'm going to just say this. Notice there's no stars, there's no extra parameters, it doesn't look like this. It's just the word get data. And I'm actually put a special note right there. Let's go ahead and run this see what it looks like. So this is the result right here, it is our dictionary. And in case we are just super, super concerned with that, we can say equals. And then D save run just to verify D equals blah, blah, blah. So what's going on into the hood here is we are saying our function is going to have a variable. And we're going to take that variable and now treat it like a function and Python smart enough to go out and say, Okay, funky is getting this guy right here. And we're now converting that to an argument for our function that is extremely cool. As long as everything just works, we can then go ahead and do something like this. Let's say print. And we can do this a number of different ways. I'm going to do it the long way just because why not. And let's go ahead and go D. And we got to worry about those single double quote issues. Again, there are other ways of doing this age. If you're wondering where I'm getting these and typing it horribly, it's actually from our dictionary object up here. So I know we have a name age and then a pet. So let's go ahead and grab the pet to could have done this a number of different ways we could have done for loop we could have, you know, tested to see if it was actually in the dictionary keys grab the item however we wanted to do it. And tada just works. Main takeaway from here is we can actually use a function as an argument, and then use that variable as a function. Very cool the way that works. I hope you enjoyed this video, you can find the source code out on github.com. If you need additional help, myself and thousands of other developers are hanging out in the void realms Facebook group. This is a large group with lots of developers and we talk about everything technology related not just the technology that you just watched. And if you want official training, I do develop courses out on you to me.com. This is official classroom style training. If you go out there and the course you're looking for is just simply not there. Drop me a note. I'm either working on it or I will actually develop it. I will put a link down below for all three of those and as always, help me help you smash that like and subscribe button. The more popular these videos become the more I'll create and publish out on YouTube. Thank you for watching.