subject

In a dictionary whose keys are the warehouses: associated with each warehouse is an inner dictionary whose keys are the stocked products (and whose associated values are the inventory of that product in the warehouse). the inventory must always be a non-negative value; an inventory of 0 is legal. for example, a simple/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 2 wallets.

the newport warehouse stocks 7 combs, and 0 staplers.

the tustin warehouse stocks 3 keychains, 4 pencils, and 3 wallets.

(d) the by_product_inventory function returns a list of 2-tuples (str, int) (product names and inventory), sorted ascending by which products have the largest inventory (the summed over all warehouses). if two products have the same inventory, they should appear in ascending order of product name: for the db dictionary above the result is [('stapler', 0), ('brush', 3), ('keychain', 3), ('pencil', 4), ('wallet', 5), ('comb', 9)].

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:00
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
question
Computers and Technology, 22.06.2019 08:10
Technician a says that if a valve is open when a piston rises to the very top of a cylinder, the piston may actually strike the valve head and cause serious engine damage. technician b says if the camshaft is located in the engine block, then the engine is called an overhead valve engine, ohv engine, or an in-block camshaft. who is right? a. b only b. both a and b c. a only d. neither a nor b
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
You know the right answer?
In a dictionary whose keys are the warehouses: associated with each warehouse is an inner dictionar...
Questions
question
Biology, 18.09.2021 19:30
question
Mathematics, 18.09.2021 19:30
Questions on the website: 13722361