I am trying to perform a calculation on multiple values in the value portion of a list of key:value pairs.
So I have something like:
[('apples', ['254', '234', '23', '33']), ('bananas', ['732', '28']), ('squash', ['3'])]
I'm trying to create a list of y-values that are the averages of those integers above.
What I'm trying to write is the following pseudocode
if item[1] contains 0 elements:
ys.append(item[1])
else if item[1] contains > 0 elements:
add up elements, divide by number of elements
ys.append average number
What I'm not sure how to do is how to access all of the values that might exist in each key's value set.