Instruction
We've prepared a small project to test your skills.
Exercise
Anne loves cooking, and she tries out various recipes from the Internet. Sometimes, though, she finds recipes that are written as a single paragraph of text. For instance:
Cut a slit into the chicken breast. Stuff it with mustard, mozzarella and cheddar. Secure the whole thing with rashers of bacon. Roast for 20 minutes at 200C.
When you're in the middle of cooking, such a paragraph is difficult to read. Anne would prefer an ordered list, like this:
- Cut a slit into the chicken breast.
- Stuff it with mustard, mozzarella and cheddar.
- Secure the whole thing with rashers of bacon.
- Roast for 20 minutes at 200C.
Write a Python script that accepts a recipe string from the user ('Paste your recipe: ') and prints an ordered list of sentences, just like in the example above.
Stuck? Here's a hint!
The general algorithm should look as follows:
- Create a new, empty string and a
countervariable. - Iterate over the recipe.
-
- If you find a full stop, add it to the new string alongside:
- a new line character
\n. - the
countervalue. - a space.
counter. - a new line character
- If you find anything other than a full stop, simply add it to the final string.
- If you find a full stop, add it to the new string alongside:
You will also need to think about handling the first and last numbers in the list. We'll leave this part to you!



