Aan de slagGa gratis aan de slag

Checking values

Great! Your shopping list is working. Let's quickly count how many items we have in our shopping list before building the final scaled version.

Deze oefening maakt deel uit van de cursus

Introduction to Python for Developers

Cursus bekijken

Oefeninstructies

  • Create a variable called items_to_buy starting at 0, then increment it by 1 for each ingredient in your shopping_list.
  • Print both the shopping_list and the total number of items_to_buy.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Count how many items to buy
items_to_buy = ____

for item in shopping_list:
    items_to_buy ____ 1

# Display results
____
____
Code bewerken en uitvoeren