BaşlayınÜcretsiz Başlayın

Modifying string values

Your recipe scaler project needs to handle ingredient names that users might enter in different formats. You want to update any generic entries to make your recipe clearer. Additionally, to ensure your shopping list doesn't have duplicate entries, you need to standardize all ingredient names to lowercase.

Bu egzersiz

Introduction to Python for Developers

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use the .replace() method to update pasta_type by changing "pasta" to "fusilli pasta".
  • Convert the ingredient_one variable to lowercase using the .lower() method.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

pasta_type = "pasta"

# Update pasta type to be more specific
pasta_type = ____

ingredient_one = "BASIL"

# Standardize ingredient_one to lowercase
ingredient_one = ____

print(pasta_type)
print(ingredient_one)
Kodu Düzenle ve Çalıştır