Cody Bable

Generation

generate functionFri, 30 Jun 2023

return list dictionary of the two biggest numbers in a list of dictionaries

def sort_two_biggest_numbers(lst): sorted_list = sorted(lst, key=lambda x: x['value']) return sorted_list[-2:] lst = [{'value': 1}, {'value': 2}, {'value': 3}] print(sort_two_biggest_numbers(lst))

Questions about programming?Chat with your personal AI assistant