I have the following dictionary:
dic = {'bsx_8612': [23, 567, 632], 'asd_6375': [654, 12, 962], 'asd_2498': [56, 12, 574], 'bsx_9344': [96, 1022, 324]}
I want to retrieve the key whose value has the largest sum of its elements. How I am doing:
chaves, valores = [], []
for item in dic:
valores.append(sum(dic.get(item)))
chaves.append(item)
chave = chaves[valores.index(max(valores))]
print(chave)
>>> asd_6375
Is there a more practical way to do this?