Hi, this is my first post. I apologize if I make any mistakes.
I have a problem where I need to take a list and print it out as a table of average
for each person. The list is : [('tom',4),('ben',5),('tom',8),('ben',12)]
So far my code is:
def getAverage(list):
list = [('tom',4),('ben',5),('tom',8),('ben',12)]
for item in list:
....
....
I know the formula to take average and sum but i'm not sure how to do it here
since there are two same names of each.
I have to print a table of average score for both persons. Not sure how to start.
Any help would be great!