Advertisement
vostrikov

Untitled

Dec 4th, 2023
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. sales_data = {
  2.     "Kuwait": [
  3.         {"name": "Headphones", "quantity": 42},
  4.         {"name": "Tablet", "quantity": 16},
  5.         {"name": "Laptop", "quantity": 42},
  6.     ],
  7.     "French Polynesia": [
  8.         {"name": "Desktop PC", "quantity": 40},
  9.         {"name": "Headphones", "quantity": 20},
  10.         {"name": "Printer", "quantity": 11},
  11.     ],
  12.     "Lesotho": [
  13.         {"name": "Desktop PC", "quantity": 2},
  14.         {"name": "Laptop", "quantity": 10},
  15.         {"name": "Router", "quantity": 17},
  16.     ],
  17.     "Brazil": [
  18.         {"name": "Desktop PC", "quantity": 33},
  19.         {"name": "Laptop", "quantity": 13},
  20.         {"name": "Smartphone", "quantity": 30},
  21.     ],
  22.     "Australia": [
  23.         {"name": "Laptop", "quantity": 37},
  24.         {"name": "Smartwatch", "quantity": 30},
  25.         {"name": "Router", "quantity": 47},
  26.     ],
  27. }
  28.  
  29. print()
  30. quantity_sum = 0
  31.  
  32. for country in sales_data:
  33.     print(country)
  34.     for data in sales_data[country]:
  35.         quantity_sum += data['quantity']
  36.  
  37.     print(quantity_sum)
  38.  
  39. print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement