MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Python for Developers

Lihat Kursus

Petunjuk latihan

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

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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)
Edit dan Jalankan Kode