What about:
print(max(x, key=sum))
Demo:
>>> x = [[1,2,3],[4,5,6],[7,8,9]] >>> print(max(x, key=sum)) [7, 8, 9]
This works because max (along with a number of other built-in python like min , sort ...) accepts a function that will be used for comparison. In this case, I just said that we should compare the elements in x based on their individual sum and Bob of our uncle, we are done!
source share