Cody Bable

Generation

generate functionFri, 30 Jun 2023

return the two biggest numbers in a list of dictionaries

def get_maximum(lst, key): return max(lst, key=lambda item: item[key]) get_maximum([{'a': 1}, {'a': 3}, {'a': 2}], 'a')

Questions about programming?Chat with your personal AI assistant