Beginner
Escape and wrap untrusted text
Write escape(text) that replaces & with &, < with < and > with > (in that order).
Write wrap(tag, text) that returns <tag>, the escaped text and </tag> on three separate lines.
What Check tests
- Plain text is unchanged
<and>are escaped&is escaped first, so no double escapingwrapputs the escaped text between the tags- The wrapped text never contains a second closing tag
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.