So I have a dict, which contains keys corresponding to a list, which contains str. I want to collect all the same values in said list and sum them together. Perhaps my explanation was confusing so I'll provide an example:
function_name({'key1':['apple', 'orange'], 'key2':['orange', 'pear'})
>>> {'apple':1, 'orange':2, 'pear':1}
How would I create this function? I was thinking of somehow making a for loop like this:
count = 0
for fruit in dict_name:
if food == 'apple'
count = count + fruit
I am still unsure about how to format this especially how to count the values and collect them, thanks in advance for any suggestions!