Tidy Up Text π§Ή
Text often arrives with messy spaces around it. .strip() trims the spaces off
both ends:
" hi ".strip() # "hi"
The cool part: you can chain methods one after another, left to right. Each one works on the result of the last:
" hi ".strip().upper() # first "hi", then "HI"
Your task
Write tidy_shout(text) that strips the spaces, makes it UPPERCASE, and
adds a "!". tidy_shout(" hi ") returns "HI!".
β‘ 35 XP
π§± Code blocks
Drag a block into the editor, or tap it to drop it in where your cursor is. Add them in order to build your answer.
solution.pyRuns in your browser (Pyodide)
Loading editorβ¦
Tests2 to pass
tidy_shout(" hi ") == "HI!"
tidy_shout("go") == "GO!"
Run your code to check these.