Math operations

Report a typo

Consider the following decorator that takes a function with two arguments and prints the arguments before calling the function.

def print_info(func):
    def wrapper(arg1, arg2):
        print("The arguments of the function are:", arg1, arg2)
        return func(arg1, arg2)

    return wrapper

Let's say we use this decorator for a function that simply returns the sum of two arguments. Then, the result for the values 22 and 25 will be the following:

The arguments of the function are: 22 25
47

Your task is to:

  1. Write the body of the function that computes and returns the sum of two arguments.
  2. Decorate this function with print_info decorator.

Tip: Use return, not print().

Write a program in Python 3
def print_info(func):
def wrapper(arg1, arg2):
print("The arguments of the function are:", arg1, arg2)
return func(arg1, arg2)

return wrapper


def addition(arg1, arg2):
...
___

Create a free account to access the full topic