Cody Bable

Generation

generate functionFri, 30 Jun 2023

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

def largest_num(list_of_dicts): return sorted(list_of_dicts, key=lambda x: x["number"], reverse=True)[:2] largest_num([{'number': 1}, {'number': 10}, {'number': -3}])

Questions about programming?Chat with your personal AI assistant