Using a Function in Another Function | Python Tutorial for Beginners

preview_player
Показать описание

Did you know that you can have a function in another function? That’s right! In this tutorial you will learn how to incorporate functions within functions in Python. To explain how this works, we use a cool example of calculating working wage with an added bonus. Enjoy watching!

365 Data Science is an online educational career website that offers the incredible opportunity to find your way into the data science world no matter your previous knowledge and experience. We have prepared numerous courses that suit the needs of aspiring BI analysts, Data analysts and Data scientists.

We at 365 Data Science are committed educators who believe that curiosity should not be hindered by inability to access good learning resources. This is why we focus all our efforts on creating high-quality educational content which anyone can access online.

#PythonFunctions #PythonTutorial #DataScience
Рекомендации по теме
Комментарии
Автор

If you analyze what’s going on, technically speaking, you are not using a function within a function. You are precisely using the same value associated with the parameter of the first function definition as the second function definition. That is not “using a function in a function”.

If you were truly using a function within a function, in the second function call you would be able to say w_bonus(w_hours) as a way to pass the original value associated with parameter/variable “w_hours” found in the function defined as wage. But this would run an error of “w_hours” not being defined.

So again, you are not actually using a function within a function, you are clearly passing the same value to both functions definitions in the function calls. And of course in the second function call you add 50.

Not to be pedantic, but as a self learner it’s frustrating when educators lack the literalness in their thinking and their language (especially in a subject as comprehensive as this) to transmit concepts in a clear and accurate way.

Technically speaking, as technicality is what I am concerned with in this kind of learning, this is NOT passing a function to another function. If that were the case, using the exact parameter from the first function definition would be all one would need to include as an argument/value in the second function call.

dgross
Автор

what if making the return statement ends up in a typeError unsupported operand type(s) for * or pov(): 'str' and 'int' ?

mammon-sama
Автор

From the heading, I expected a function defined within the body of another function in this video. You did not do the same here!

ফকিরতালিব
Автор

Very nice, can you please provide all this in a single pdf, it's helps us a lot

bamanjagadeesh