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



25 views0 comments

Recent Posts

See All