[Solved] Python miminum length/max value in dictionary of lists


def get_smallest_length(x):
    return [k for k in x.keys() if len(x.get(k))==min([len(n) for n in x.values()])]

def get_largest_sum(x):
    return [k for k in x.keys() if sum(x.get(k))==max([sum(n) for n in x.values()])]

x = {'a': [4, 2], 'c': [4, 3], 'b': [3, 4], 'e': [4], 'd': [4, 3], 'g': [4], 'f': [4]}

print get_smallest_length(x)
print get_largest_sum(x)

Returns:

['e', 'g', 'f']
['c', 'b', 'd']

0

solved Python miminum length/max value in dictionary of lists