info_outline

Solutions will be available when this assignment is resolved, or after a few failing attempts.

Pretty Results Decorator

Implement a @pretty_result decorator that changes the result of any function, returning the result plus a pretty message. Example, the function sum(1, 2) should return 3. If applied @pretty_result it should return "The result of the function 'sum' is: 3".

Test Cases

test subtract function - Run Test

def test_subtract_function():

    @pretty_result
    def subtract(x, y):
        return x - y

    assert subtract(13, 8) == "The result of the function 'subtract' is: 5"

test add function - Run Test

def test_add_function():
    @pretty_result
    def add(x, y):
        return x + y

    assert add(2, 5) == "The result of the function 'add' is: 7"
def pretty_result(original_function): pass # This is for your testing purposes # Uncomment and "Run Code": # ======================================== # @pretty_result # def add(x, y): # return x + y # print(add(2, 5)) # ======================================== # Do you see: "The result of the function 'add' is: 7" ??