We use Python 3.6

go back Level: Intermediate (img: IM / score: 3) level Bite 22. Write a decorator with argument

119 out of 124 users completed this Bite ...
Will you be Pythonista #120 to crack this Bite?
Average Bite difficulty 1-10 rating: 5.12
» Up for a challenge? 💪

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!

Github login button