Cody Bable

Generation

generate functionFri, 30 Jun 2023

return the two biggest numbers in a list of dictionaries

L = [{'a':3, 'b':5}, {'a': 2, 'b':6},{'a':1, 'b':8}] def two_biggest(list): b_list = sorted(list, key=lambda x:x['b']) return b_list[-1], b_list[-2] two_biggest(L)

Questions about programming?Chat with your personal AI assistant