Algorithmic predicament - Bug Fixing #9

Oh no! Timmy's algorithim has gone wrong! help Timmy fix his algorithim! 

Task
Your task is to fix timmy's algorithim so it returns the group name with the highest total age. 

You will receive two groups of `people` objects, with two properties `name` and `age`. The name property is a string and the age property is a number.  
Your goal is to make the total the age of all people having the same name through both groups and return the name of the one with the highest age. If two names have the same total age return the first alphabetical name.

Difficulty: introductory

Starter code:

def highest_age(group1,group2):
	

Solutions:
from collections import Counter
from itertools import chain


def highest_age(persons1, persons2):
    c = Counter()

    for p in chain(persons1, persons2):
        c[p['name']] += p['age']

    return min(iter(c.items()), key=lambda n_a: (-n_a[1], n_a[0]))[0] if c else None


from functools import reduce

def choose(a, b):

    if a[1] < b[1]:
        return b
        
    if a[1] > b[1]:
        return a
        
    return a if a[0] < b[0] else b
    

def highest_age(group1, group2):
    
    totals = {}
    
    for item in group1 + group2:
        name = item['name']
        totals[name] = totals.get(name, 0) + item['age']
        
    return reduce(lambda acc, x: choose(acc, x), totals.items(), ('', -1))[0]

def highest_age(g1, g2):
    d = {}
    for p in g1 + g2:
        name, age = p["name"], p["age"]
        d[name] = d.setdefault(name, 0) + age
    return max(sorted(d.keys()), key=d.__getitem__)


from collections import defaultdict
from itertools import chain

def highest_age(group1, group2):
    total = defaultdict(int)
    for person in chain(group1, group2):
        total[person['name']] += person['age']
    return min(total, key=lambda p: (-total[p], p))

def highest_age(group1,group2):
    d = {}
    lst = []
    for i in group1 + group2:
        name = i['name']
        if name in d:
            d[i['name']] += i['age']
        else:
            d[name] = i['age']
    n = max(d.values())
    for k, v in d.items():
        if n == v:
            lst.append(k)
    return min(lst)

from collections import Counter

def highest_age(group1, group2):
    total = Counter()
    for person in group1 + group2:
        total[person['name']] += person['age']
    return min(total, key=lambda name: (-total[name], name))

def highest_age(group1,group2):
    total={}
    
    for p in group1+group2:
        total[p['name']] = total.get(p['name'],0)+p['age']
    
    return sorted(total, key=total.__getitem__)[-1]