Python program to find maximum value in List


Program:

list=[(1,15,11), (4,7,1), (7,11,2),(10,10,18)]

print("The list is: " +str(list))

res1=max(list)[0]

res2=max(list)[1]

res3=max(list)[2]

print("The max of index 1: " +str(res1))

print("The max of index 2: " +str(res2))

print("The max of index 3: " +str(res3))


Output:

The list is: [(1, 15, 11), (4, 7, 1), (7, 11, 2), (10, 10, 18)]

The max of index 1: 10

The max of index 2: 10

The max of index 3: 18



13 views0 comments

Recent Posts

See All

Python Program to Find Sum of Series 1²+2²+3²+….+n²

The mathematical formula to find the sum of 1²+2²+3²+….+n² is n(n+1)(2n+1)/6 So to find the sum of series we use this formula. Program: n = int(input("Enter Positive Number : ")) sum = 0 sum= (n*(n+