The trip's spending has one entry per line: a category and an amount, like "food 30". Write biggest_spend(text): add up each category and return the one with the most spent. With no entries, return None (already in the starter). No two categories tie.
biggest_spend("food 30\nbus 12\nfood 25\nhotel 50")→'food'biggest_spend("")→Nonedef biggest_spend(text):
if text == "":
return None
spent = {}
for line in text.splitlines():
kind, money = line.split()
# your code here: add this amount to its category's total
# your code here: return the category with the biggest total
return None
Run tries the examples. When they look right, Submit.