Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fruit_count, not_fruit_count = 0, 0
- basket_items = {'apples': 4, 'oranges': 19, 'kites': 3, 'sandwiches': 8}
- fruits = ['apples', 'oranges', 'pears', 'peaches', 'grapes', 'bananas']
- #Iterate through the dictionary
- for fruit, count in basket_items.items():
- if fruit in fruits:
- fruit_count += count
- else:
- not_fruit_count += count
- print(fruit_count, not_fruit_count)
Add Comment
Please, Sign In to add comment