Function Multiplying and Adding Results

  • Share this:

Code introduction


This function takes three arguments, where the first argument is used to multiply with the return value, the second argument is used to add to the return value, and the third argument is the value passed to the inner function. The inner function squares the passed value and returns it.


Technology Stack : Built-in functions, closure, function decorator

Code Type : Function

Code Difficulty : Intermediate


                
                    
def aaaaaa(arg1, arg2, arg3):
    def bbbbbbb(func):
        def wrapper(*args, **kwargs):
            result = func(*args, **kwargs)
            return result * arg1 + arg2
        return wrapper
    @bbbbb
    def ccccccc(x):
        return x ** 2
    return ccccccc(arg3)