SECTION 25 / 31

Change the key to compare shops

1 min read
Food ROW totals from all 30 supplied cards: SV Stores73, Big Bazaar15, Sun General9. These are recomputed totals, not the spoken tally.
Food ROW totals from all 30 supplied cards: SV Stores73, Big Bazaar15, Sun General9. These are recomputed totals, not the spoken tally.

To ask which shop has most Food rows, keep the same qualifying item test but use bill.Store as the key. The fixed three-shop problem could use three counters, but a dictionary also handles new shops without inventing a new variable for every name.

ShopFood item rows in all 30 cards
SV Stores73
Big Bazaar15
Sun General9
Total97

The spoken Lecture 7.6 tally is 72,10,9. We preserve the original bill cards and recompute 73,15,9: the spoken SV accumulation includes an addition slip, and Radha’s five Food rows in Bill 30 belong to Big Bazaar. The learning pages use the complete original dataset rather than forcing the spoken totals.

SV Stores is highest under the Food-row measure. Calling it “most popular” needs that measure stated: it is not necessarily highest revenue, most bills or most distinct customers. Changing the requested category may change which shop leads.

Try it yourself

Why can the shop and customer dictionaries have the same grand total?

Show explained answer

They partition the same 97 Food rows by different keys. Each qualifying row contributes once to each partition.

Try it yourself

Can a dictionary handle a fourth shop?

Show explained answer

Yes. Create its key when a qualifying row first appears.

Try it yourself

Does 73 mean 73 customers?

Show explained answer

No. It means 73 Food item rows across the observed bills at SV Stores.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑