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.
Bu egzersiz
Introduction to Python for Developers
kursunun bir parçasıdırEgzersiz talimatları
- Create a variable called
items_to_buystarting at 0, then increment it by 1 for each ingredient in yourshopping_list. - Print both the
shopping_listand the total number ofitems_to_buy.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Count how many items to buy
items_to_buy = ____
for item in shopping_list:
items_to_buy ____ 1
# Display results
____
____