Python 7.7: Return multiple values
We continue with what we did before, we extracted the part that allows us to display the information and now we'll create a function that allows us to retrieve ... the information of the person from giving a price by the user at the terminal through the input function so what's the point of this function, since we don't have to do it? It allows us to retrieve the information of a person, elsewhere if for example we just want to display, retrieve the information and not display it so it will be more favorable for us and easier to do and here you're going to do that and you'll see that it's easier to retrieve several pieces of information through the return keyword we're going to make a def def I'm going to put return information so that's what your function will be called colon inside take this there is an error and it will take as a parameter a person number we're going to call the function here retrieve information here we see that has an error in name and age, name person age person simply because the variables that are in The function retrieve information are local to this function so here we will make name equal to retrieve the name and here I will first delete like this and I will put age equal to zero Parameters Obsolete I run my code name of the person aunt age 23 I am told that there is an error on the line there is an error simply because the retrieve information function returns nothing so we will put in return equal to name person I relaunch name person aunt age 23 you see that everything works normally our objective here is to return several values through the water keywords return for that I'll put a comma at this level I'll put age person at this level I will put comma age as well as here age without forgetting the comma it's good, I restart my code name of the person sleep age 23 4 characters everything works person's name tototi age you see that it works normally person's name dana danati age everything works normally, so in general to return several values through the return keyword we just ... need a comma and we continue our program so you can do it differently, you just need to have some logic. that was it for this video and ... we'll see you soon for another one about parameter types and return.