What is the output of the following code? def star(func): def inner(*args, **kwargs): print("*" * 3) func(*args, **kwargs) print("*" * 3) return inner def percent(func): def inner(*args, **kwargs): print("%" * 3) func(*args, **kwargs) print("%" * 3) return inner @star @percent def printer(msg): print(msg) printer("Hello")

Questions & AnswersCategory: Programming LanguageWhat is the output of the following code? def star(func): def inner(*args, **kwargs): print("*" * 3) func(*args, **kwargs) print("*" * 3) return inner def percent(func): def inner(*args, **kwargs): print("%" * 3) func(*args, **kwargs) print("%" * 3) return inner @star @percent def printer(msg): print(msg) printer("Hello")
Adam asked 2 years ago

What is the output of the following code?

def star(func):

    def inner(*args, **kwargs):

        print("*" * 3)

        func(*args, **kwargs)

        print("*" * 3)

    return inner

def percent(func):

    def inner(*args, **kwargs):

        print("%" * 3)

        func(*args, **kwargs)

        print("%" * 3)

    return inner

@star

@percent

def printer(msg):

    print(msg)

printer("Hello")

a. ***
%%%
Hello
%%%
***
b. %%%
***
Hello
***
%%%
c. %%%
***
Hello
%%%
***
d. ***
***
Hello
%%%
%%%