Guest User

Untitled

a guest
Jul 16th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. fruit_count, not_fruit_count = 0, 0
  2. basket_items = {'apples': 4, 'oranges': 19, 'kites': 3, 'sandwiches': 8}
  3. fruits = ['apples', 'oranges', 'pears', 'peaches', 'grapes', 'bananas']
  4.  
  5. #Iterate through the dictionary
  6. for fruit, count in basket_items.items():
  7. if fruit in fruits:
  8. fruit_count += count
  9. else:
  10. not_fruit_count += count
  11.  
  12. print(fruit_count, not_fruit_count)
Add Comment
Please, Sign In to add comment