Text framing
Created on June 5, 2021 by Julien Palard
In this exercise, we'll frame text.
To frame text, we'll first define what's a frame, by using a dataclass:
1 2 3 4 5 6 7 8 9 10 | |
We'll then be able to easily create new frames:
1 2 | |
The prototype of your function should be:
1 2 | |
Meaning your function has to accept two parameters: some text, and the frame to apply.
Your function should return the framed text.
Examples
1 | |
Should give:
1 2 3 | |
Beware, your function should return the framed text, but not print it, this will allow you to compose frames:
1 2 3 | |
gives :
1 2 3 4 5 | |
Beware of multi-line text:
1 2 3 4 5 | |
should give:
1 2 3 4 5 6 | |
There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
Keyboard shortcuts:
- Ctrl-Enter: Send your code to the correction bot.
- Escape: Get back to the instructions tab.