From the course: Python: Decorators
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: HTML styling with decorators - Python Tutorial
From the course: Python: Decorators
Challenge: HTML styling with decorators
(bright chime) - [Instructor] Now I'm guessing you've come across HTML before. If you haven't, it's relatively straightforward. If you want some text to be bold then you put the text between bold tags which is a b in between angle brackets. The first one marks the start of bold and the second tag with an additional slash mark besides the b marks the end. It's very similar for italics except this time we use the I open and close tag. Go ahead and grab the challenge_html Python file. We'll use this as our starting point. Using the print fib function that we've seen before, create two decorators, bold and italic. The output should be Fibonacci in between the bold and italic tags and make sure you get the correct order. So that's Fibonacci is first in italics and then you make the italicized text bold. You've also learned how to preserve the original name and doc string of the original function. So include that in your…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.