How to find the list in a list of lists whose sum of elements is the greatest?

Viewed 1021

I have a list of lists:

x = [[1,2,3], [4,5,6], [7,8,9], [2,2,0]]

I want to get the list whose sum of its elements is the greatest in the list. In this case [7,8,9].

I'd rather have a fancy map or lambda or list comprehension method than a for/while/if loop.

Best Regards

3 Answers
num = [[1, 2, 3], [4, 5, 6], [10, 11, 12], [7, 8, 9]]
 
index = 0
max_index = 0
sum_max = 0
for list in num:
>>>>sum_list = 0
>>>>for x in list:
>>>>>>>>sum_list += x
>>>>if sum_list > sum_max:
>>>>>>>>sum_max = sum_list
>>>>>>>>max_index = index
>>>>index += 1
print(num[max_index])`enter code here`
Related