Product count per region
Your task
A sales team wants product breadth per region, not volume. Each row is "region,product,amount"; the same region-product pair can recur across many sales. Return a dictionary mapping each region to how many DISTINCT products it sold (the amount is irrelevant). Example: ["west,mug,10", "west,mug,20", "west,tee,5", "east,cap,7"] gives {"west": 2, "east": 1}.
Examples
distinct_products(rows: list[str]) -> dict[str,int]Example 1
Input
distinct_products(["west,mug,10", "west,mug,20", "west,tee,5", "east,cap,7"])Output
{"west": 2, "east": 1}