Files
30-seconds-of-code/snippets/capitalize_every_word.md
2019-02-11 18:26:07 +08:00

302 B

capitalize_every_word

Capitalizes the first letter of every word in a string.

Uses str.title to capitalize first letter of every word in the string.

def capitalize_every_word(string):
    return string.title()
capitalize_every_word('hello world!') # 'Hello World!'