Python program to make a chain of function decorators (bold, italic, underline etc.


Topic: Python program to make a chain of function decorators (bold, italic, underline etc.

Solution

def make_bold(fn):
    def wrapped():
        return "" + fn() + ""
    return wrapped
def make_italic(fn):
    def wrapped():
        return "" + fn() + ""
    return wrapped
def make_underline(fn):
    def wrapped():
        return "" + fn() + ""
    return wrapped
@make_bold
@make_italic
@make_underline
def hello():
    return "hello world"
print(hello())



List all Python Programs