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.
Solution: Beautify your output - Python Tutorial
From the course: Python: Decorators
Solution: Beautify your output
(bright music) - [Instructor] Let's use the decorator template as our starting point. Now one possible solution is to print out the top half of the box then call the PFIB function and the finally print out the bottom half of the box. So let's modify our wrapper to do just that. Let's just experiment to try and figure out how we print out the top half of the box. Now Fibonacci has nine characters so we need nine dashes and then we need a symbol on either side. So print, a cross, and then nine dashes. And another cross. We then need the borders. So that's the pipe symbol and then nine spaces. And the pipe symbol again. We then want to call our functions, so result equals func. And finally let's print out the bottom half of the box. So we need the same border so I'm just going to copy the line from above. And we need the bottom row. And we need to use equals signs instead of the dashes so we need nine equals…
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.