Cody Bable

Generation

generate functionFri, 30 Jun 2023

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

def two_biggest(d_list): sorted_list = sorted(d_list, key=lambda t:t['number'], reverse=True) return sorted_list[:2] two_biggest([{'number':1}, {'number':3}, {'number':2}, {'number':4}, {'number':7}])

Questions about programming?Chat with your personal AI assistant