I dont get this Functions Calling Functions



can someone explain more details about function calling other function. i dont get it and i dont know the answer. this is shameful lol :cry:


Functions calling other functions is like normally calling functions really. Just make sure the function being called is defined above the function that is calling it. You just call it the same way you'd call it outside a function.

def one_good_turn(n):
    return n + 1
def deserves_another(n):
    return one_good_turn(n) + 2

As you see, one_good_turn() is defined above deserves_another(), and both take the argument n. Then, as like you would outside of another function, one_good_turn() is called, just within the deserves_another() function, so it can be added to 2, making the result of deserves_another() equal to the result of one_good_turn() + 2.


thanks for the explanation. still need a time to grasp this though


If you run into anything else feel free to post.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.