Skip to content

Strings · routine

Capitalise each word

Write capitalise_words(text) returning the words of text separated by single spaces, each with its first letter capital and the rest lower case. "hELLO wORLD" becomes "Hello World".

Run adds print(capitalise_words("hELLO wORLD")) after your code, to try it.

Stuck on the idea rather than the code? The String methods lesson walks through it.