Nested Function Transformation

  • Share this:

Code introduction


This function is a nested function that first performs a division by 2 on the input parameter using an inner function `arg2`, then passes the result to another inner function `arg1` to multiply by 2, and finally returns this multiplied result.


Technology Stack : Recursive call, parameter passing

Code Type : Function

Code Difficulty : Intermediate


                
                    
def aye(arg1, arg2):
    def arg1(arg):
        return arg * 2
    def arg2(arg):
        return arg / 2
    return arg1(arg1(arg2(arg)))