Cody Bable

Generation

generate functionFri, 30 Jun 2023

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

def get_two_biggest(lst): lst.sort(key=lambda x: x['num'], reverse=True) return lst[:2] get_two_biggest([{'num': 1}, {'num': 2}, {'num': 3}])

Questions about programming?Chat with your personal AI assistant