Each sale is stored as a (category, amount) pair. The weekly email names the category that brought in the most money.
Write a function top_category(sales) that adds up the amounts for each category and returns the category with the highest total. You can assume there's at least one sale and no ties.
How it's checked
Your code runs, then the check below runs and its printed output is compared with ours.
top_category([("toys", 20), ("books", 15), ("toys", 5), ("books", 30)]) returns "books"Hints, the later steps and the answer come with Pro.
def top_category(sales):
...