Question: 
Write a function to calculate the maximum aggregate from the list of tuples.


Model's Code:
def max_aggregate(data):
    aggregate = {}
    for name, score in data:
        if name in aggregate:
            aggregate[name] += score
        else:
            aggregate[name] = score
    return max(aggregate.items(), key=lambda x: x[1])



Sample Correct Code:
from collections import defaultdict
def max_aggregate(stdata):
    temp = defaultdict(int)
    for name, marks in stdata:
        temp[name] += marks
    return max(temp.items(), key=lambda x: x[1])


Asserts:
assert max_aggregate([('Juan Whelan',90),('Sabah Colley',88),('Peter Nichols',7),('Juan Whelan',122),('Sabah Colley',84)])==('Juan Whelan', 212)
assert max_aggregate([('Juan Whelan',50),('Sabah Colley',48),('Peter Nichols',37),('Juan Whelan',22),('Sabah Colley',14)])==('Juan Whelan', 72)
assert max_aggregate([('Juan Whelan',10),('Sabah Colley',20),('Peter Nichols',30),('Juan Whelan',40),('Sabah Colley',50)])==('Sabah Colley', 70)


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 299 of 974: 218/299 (72.90969899665552%): success