return list dictionary of the two biggest numbers in a list of dictionaries
def two_biggest_numbers(dicts): return sorted(dicts, key=lambda x: x['number'], reverse=True)[:2] names = [ { 'name': 'Cheryl', 'number': 79 }, { 'name': 'Michael', 'number': 100 }, { 'name': 'Leo', 'number': 1 }, { 'name': 'Edward', 'number': 12 }, ] two_biggest_numbers(names)