Skip to main content

Inventory Aggregator

Challenge on lesson: Checkpoint: Files + Modules

CHALLENGE
Difficulty: beginner+25 XP

csv_text = "apple,fruit\ncarrot,veg\nbanana,fruit\nleek,veg\ncherry,fruit" is given. Write count_categories(text) that parses the CSV (comma-separated, one item per line) and returns a dict mapping each category (column 2) to how many items it has. Print the dict โ€” one line.

Back to lesson: Checkpoint: Files + Modules