Python Program to Find the List in a list of lists Whose Sum of Elements is the Highest

In this example, we will write a simple program to find the list with the highest sum of elements in the given list and print the result. To better understand this example, make sure you have knowledge of the following tutorials:-

Input : [[1, 2, 3], [4, 5, 6], [10, 11, 12], [7, 8, 9]]
Output: [10, 11, 12]
Explanation: the sum of all lists in the given list of lists are:
list1 = 6, list2 = 15, list3 = 33, list4 = 24
so the maximum among these is of list 3

Python Program to Find the List in a list of lists Whose Sum of Elements is the Highest using for loop

The output of the above program is:-

[10, 11, 12]

Python Program to Find the List in a list of lists Whose Sum of Elements is the Highest using max function

The output of the above program is:-

[10, 11, 12]
SHARE Python Program to Find the List in a list of lists Whose Sum of Elements is the Highest

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Share