Python38 One Line Statement Dictionary Whose Keys Warehouses Associated Warehouse Inner Di Q43872656
python3.8 one line statement
in a dictionary whose keys are the warehouses: associated witheach warehouse is an inner dictionary whose keys are the stockedproducts (and whose associated values are the inventory of thatproduct in the warehouse). The inventory must always be anon-negative value; an inventory of 0 is legal. For example, asimple/small database might be.
db = {‘Irvine’ : {‘brush’: 3, ‘comb’: 2, ‘wallet’: 2},’Newport’: {‘comb’: 7, ‘stapler’: 0},
‘Tustin’ : {‘keychain’: 3, ‘pencil’: 4, ‘wallet’: 3}}
This data structure means that
-
The Irvine warehouse stocks 3 brushes, 2 combs, and 2wallets.
-
The Newport warehouse stocks 7 combs, and 0 staplers.
-
The Tustin warehouse stocks 3 keychains, 4 pencils, and 3wallets.
(a) The by_product_inventory_count function returns a list ofstr (warehouse names), sorted ascending by which warehouses havethe largest number of products. If two warehouses store the samenumber of products, they should appear in ascending order ofwarehouse name: for the db dictionary above the result is[‘Newport’, ‘Irvine’, ‘Tustin’].
Expert Answer
Answer to python3.8 one line statement in a dictionary whose keys are the warehouses: associated with each warehouse is an inner d…
OR