1002 B
1002 B
type, title, xp, duration, difficulty
| type | title | xp | duration | difficulty |
|---|---|---|---|---|
| challenge | The Methods | 50 | 30 | 2 |
The Methods
[INCOMING — Mission Control, Earth]
Cadet, every string carries a toolkit of methods. The most-used:
s.upper()— uppercase copys.lower()— lowercase copys.strip()— drops leading/trailing whitespaces.replace(a, b)— everyabecomesbMethods can be chained — each returns a new string you can call the next on:
" Hello World ".strip().lower().replace(" ", "_") # → "hello_world"Implement
transform(s)that returns a dict with three keys:
upper— input uppercasedlower— input lowercasedclean— input stripped, lowercased, spaces replaced by_[END TRANSMISSION]
Your Task
In starter/starter.py, build the dict using the four methods.
Objectives
transform(" Hello World ")["clean"]returns"hello_world"- All three keys present and correct for any string