Psst! Check what courses we have in our offer, and get them all here to save $727. Act fast–this deal is available only 3/14–3/21.
Basic utility functions
Basic manipulation functions
Replacing and splitting
10. The replace() function


Well done! Another interesting function is replace(old, new). It replaces all instances of old with new in a string. Take a look:

story = ('Anne was hungry, so she went to a restaurant. '
  'When the waiter came up to her, Anne ordered some vegetarian dishes.')
print(story.replace('Anne', 'Katherine'))

When we print the story, the protagonist's name will be changed to Katherine.


Given an article about Pythonidae, print its contents with every sentence beginning on a new line.

Stuck? Here's a hint!

Use the replace() function to find every instance of a period followed by a space. Replace those instances with a period followed by the newline character (\n).