return list dictionary of the two biggest numbers in a list of dictionaries
numbers = [ {'id': 1, 'value': 3}, {'id': 2, 'value': 1}, {'id': 3, 'value': 6}, {'id': 4, 'value': 2} ] def get_two_biggest(numbers): numbers_sorted = sorted(numbers, key=lambda k: k['value']) return numbers_sorted[-2:] get_two_biggest(numbers)