Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python3.8 one line statement in a dictionary whose keys are the warehouses: associated with each warehouse is an inner dictionary whose keys are the stocked

python3.8 one line statement

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

  1. The Irvine warehouse stocks 3 brushes, 2 combs, and 2 wallets.

  2. The Newport warehouse stocks 7 combs, and 0 staplers.

  3. The Tustin warehouse stocks 3 keychains, 4 pencils, and 3 wallets.

(a) The by_product_inventory_count function returns a list of str (warehouse names), sorted ascending by which warehouses have the largest number of products. If two warehouses store the same number of products, they should appear in ascending order of warehouse name: for the db dictionary above the result is ['Newport', 'Irvine', 'Tustin'].

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

Discuss unique features of an E - Commerce.

Answered: 1 week ago