IniziaInizia gratis

Building the recipe scaler

You've learned all the building blocks - now it's time to bring everything together! Your recipe scaler needs to: check if you have enough ingredients in your pantry, scale the recipe for more servings, and create a shopping list for missing items. The original tomato and basil pasta recipe serves 4 people, and you're hosting a party for 10.

Your pantry has been set up as a dictionary with current quantities, and the recipe dictionary contains the base ingredient amounts. The scale_factor has also been set up as party size / original serving size (10/4).

Questo esercizio fa parte del corso

Introduction to Python for Developers

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

shopping_list = []

# Loop through each ingredient and amount in the recipe
for ____, ____ in ____:
  print(ingredient)
Modifica ed esegui il codice