Answer:
from functools import reduce
from collections import Counter
def cal_max_avg( mydict ):
new_item = [ ]
for items in mydict.items():
reducer = reduce(lambda x,y: x + y, items[1])/3
new_item.append((items[0], reducer))
newdict = Counter(dict(new_item))
return newdict.most_common(1)
diction = {'john': [45,54,56], 'yolanda':[98,78,87], 'Joshua':[67,78,87]}
result = cal_max_avg( diction )
Step-by-step explanation:
The python function accepts a dictionary and returns a tuple of the key from the input dictionary with the maximum average score for the students.