The name nobody typed carefully
Ask two hundred students to type their names and you will get " sHUBHAM unhale ". Stray spaces at the ends, capitals in the wrong places. Sorting a list like that puts the same name in three places. Cleaning it is the first job of nearly every real dataset, and you will do it properly with pandas later. Here you do it to one name, by hand.
raw.strip(). Read it as "take what is in raw, and strip it". The brackets are needed even when there is nothing to put inside them.A method does not change the original box. It hands back a fresh value, which you then have to keep somewhere — that is why each line stores its answer in a new box.
len(x) counts how many characters are in a piece of text. Spaces count. It is how you prove the cleaning actually removed something.The three you need
| Method | What it does | Applied to " sHUBHAM unhale " |
|---|---|---|
| .strip() | removes spaces from both ends only | "sHUBHAM unhale" |
| .title() | capital at the start of each word, small letters after | " Shubham Unhale " |
| .upper() | every letter made capital | " SHUBHAM UNHALE " |
Order matters less here than you might expect, but names are stored tidily as Shubham Unhale, not SHUBHAM UNHALE, so pick the method that produces that.
What you are building
The square brackets are there on purpose. Spaces are invisible, and the only way to see where a piece of text really ends is to print something after it.
.strip() only tidies the two ends. Spaces stuck in the middle of a name need splitting the text apart and joining it back together, which waits until you meet lists properly.Arrange the steps
Six things have to happen. Two are already in place — the note at the top and the messy name itself. Click the remaining four in an order that works.
Each box is built out of the one before it. One of these four could sit almost anywhere; the rest could not.
Your plan
The steps still to place
Fill the statements
Your steps written as Python. Three pieces are missing. Two of them are method names, and Python only knows the names it was taught.
Leave nothing on "choose…". A wrong pick does not always cause an error — sometimes it just prints something you did not expect, which is the harder kind of mistake to spot.
Run and read
Here is the whole programme. The messy name is yours to change — add spaces at the ends, put capitals in the wrong places, and see whether the cleaning still copes.