Python Title Case Words
split + capitalizePractice

Capitalize the first letter of each word

Split on spaces, call capitalize() on every word, then join them back.

Picture this: capitalize each word

Split on spaces, fix each word, join back.

sentencewords
→
split()list
→
capitalizeHello
→
joinone string

In easy words

Titles look nicer when each word starts with a capital. Python already has str.capitalize() for one word.

Where this is used

Name formatting, headlines, and cleaning messy user input.

Run algorithm

Each step highlights the matching Python line. Program output appears only when a line that prints actually runs.

Ready
words after split()
1s = input()
2words = s.split()
3titled = [w.capitalize() for w in words]
4print(" ".join(titled))
Output:

Example Program

1s = input()
2print(" ".join(word.capitalize() for word in s.split()))