Aan de slagGa gratis aan de slag

Multi-line strings

Your recipe scaler project needs to store detailed cooking instructions for each recipe. These instructions often span multiple lines and include several steps. You'll practice storing a multi-line string that contains the complete cooking directions for a pasta dish, making it easy to read and maintain in your code.

Deze oefening maakt deel uit van de cursus

Introduction to Python for Developers

Cursus bekijken

Oefeninstructies

  • Create a multi-line string variable called cooking_instructions that contains the three-step pasta cooking process shown in the comments.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Store the multi-line cooking instructions
# Step 1: Boil water in a large pot
# Step 2: Add pasta and cook for 10 minutes
# Step 3: Drain and serve with sauce
cooking_instructions = ____

print(cooking_instructions)
Code bewerken en uitvoeren