avatar Bite 22. Write a decorator with argument

Write a decorator called make_html that wraps text inside one or more html tags.

As shown in the tests decorating get_text with make_html twice should wrap the text in the corresponding html tags, so:

@make_html('p')
@make_html('strong')
def get_text(text='I code with PyBites'):
    return text

- would return: <p><strong>I code with PyBites</strong></p>

Have fun and start to grok decorators!

Login and get coding
go back Intermediate level
Bitecoin 3X

726 out of 737 users completed this Bite.
Will you be the 727th person to crack this Bite?
Resolution time: ~52 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 5.68 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help