Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Basic utility functions
Basic manipulation functions
8. The upper(), lower(), and capitalize() functions
Replacing and splitting


Very well done! All the functions we've introduced so far were used to test the characteristics of strings. Now, let's take a look at a few functions that are used to modify strings:

username = input('What\'s your name?: ')
print('Hello, ' + username.capitalize() + '!')

The capitalize() function converts the first string character into uppercase and all subsequent characters into lowercase. Two other similar functions are also available: upper() converts all characters into uppercase, and lower() converts all characters into lowercase.


We organized a small contest. The task was to write a sentence with as many words containing "milk" as possible. The sentences are stored in a variable named contestant_sentences.

Analyze the list and print the following result:

The best score is: {x} times "milk" was used in a single sentence!

Remember that the word milk may appear in any case in those sentences!

Stuck? Here's a hint!

Iterate over the sentences. Combine lower() and count('milk') to find the instances of milk in all different cases.