Python program to find maximum value in List
top of page

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



34 views0 comments

Recent Posts

See All

Python program to calculate the factorial of a number

Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument. This program is most for O Level Practical Exam so read it care

NumPy program to find the most frequent value in the list.

This program is most for O Level Practical Exam so read it carefully. Program: import numpy as np x = np.array([1,2,3,4,5,7,2,1,1,1,8,9,1]) print(x) print("most frequent value in the list:") print(np.

bottom of page