51. Problem to create a list of lists whose sum of elements is highest.

In this Python list program, we will take a user input as a list and find the list in a list of lists whose sum of elements is the highest with the help of the below-given steps.

List of lists having sum of list elements:

Steps to solve the program
  1. Take user input as a list of lists.
  2. Use the built-in max() function and set key=sum to get the list having the maximum sum of elements.
  3. Print that list.
				
					#Input list
list1 = [[11, 2, 3], [4, 15, 2], [10, 11, 12], [7, 8, 19]]

#Printing output
print(max(list1,key=sum))
				
			

Output :

				
					[7, 8, 19]
				
			

Related Articles

Move all zero digits to the end

Items that start with a specific character

Leave a Comment