 Hey, what's up guys root of the knoll here bringing you some more Python tutorials? This is actually your 13th tutorial so give yourself a good pat on the back for coming this far and let's get started I'm gonna fire up idle you can do the same I'll drag it over here so you guys can see it and let's get to programming Today we're gonna be finishing up this little Function mini series for the moment. We've actually still got a lot to cover But hey, we're gonna knock it down one by one as always and Yeah, today we're gonna check out that you return keyword The return keyword is what's going to allow you to bring your variables and your data back and forth between scopes Like when you pass in a variable to a function That's bringing it into that scope and then we have to manipulate it from the function and bring it back out to the Regular scope like the global scope, so I'm gonna get started with my shebang line environment Python I'm gonna save this as a File dot Python as always let's let's overwrite that and let's get ready to roll So here we go. Let's define it actually what's Okay, this is the global scope Give ourselves a little bit of a notification of what is going on and here we go Now I want to print that's not so what I want to do. I want to define a new function Let's call this add. Let's make something really simple first off. Let's get some variables here It's gonna set a is equal to zero by default and B is equal to zero by default So in case the user in case the programmer decides not to add anything. It'll just return zero So yeah, this is exactly what we're gonna do. We're gonna use the return keyword and then a plus B There that's kind of simple. So now if we print out, let's see add 10 and 20 this is kind of a terrible example But it's it's so simple. It's almost embarrassing. This is the global scope and then we get 30. That's good. That's good. So Because we're doing that in the print function though That's the only way it's going to be seen because add is only returning the variable You're not gonna see it during runtime. It's just displaying it out We could set up a new variable here like we could just set up maybe some is equal to that's that's a keyword I don't want to use that Addition equals add so now we can print out Edition Let's run that and we get 30 now the way this works is because you're using Addition and setting it to the value that comes from out comes out of using the add function It's kind of like we like what we were doing before with our get info function And let's let's in fact, let's use that for a little bit. I'll comment out these here and Let's define that get info function that we've been using so much in the last the last tutorial I'm not gonna give it any arguments this time, but we're still gonna use user input equals raw inputs What should we say and I won't bother with names or anything goes like that but outcome can equal says and then add user input So there we go I'll bring Outcome right back out of that function so we can work with it later on if we need to and see user input is Going to get the value of raw input and like I said this so many times before when you type in a value That's going to be returned and brought to user input So that way outcome is going to equal the concatenation of says and user input and then we can return that outcome So if we just do Let's see fine Now we don't need a new function. We just need prints Get info so we're going to run the get info function And we're gonna get asked for the input and then what we what is displayed is Going to be that outcome that we've just got from after reading that information. So if we run this It's got to be safe, but that's fine. This is the global scope. Okay, that's at the top We don't have to worry about that we got add but we don't have to worry about that And then we just go straight into a we're gonna go straight into get info. What should we say? Um, let's say How about that stove and Then it's going to say says how about that stove, but the thing is we're not saying we're not telling it to output that inside the function It's going out of the function and into the print function right here. It's reversing the scope almost And that's all the return keyword really does it'll bring it outside So now that you know all these between the return keyword the default parameters the multiple parameters Well, how a function works why you should use them why they work the way they do and that sort of thing You'll be able to understand more of the functions that are in Python's language And you can actually move into the keywords and the terminology the syntax and more structural things structural logic that you'll be able to work with and That was kind of a goal with this sort of mini series So for now you guys are set and we are going to be able to move into some more interesting stuff So thank you for sticking with me guys, and I'll see you in the next video