python find greatest value in list code example
Example 1: python largest value in list
>>> list = [1, 3, 2, 0]
>>> max(list)
3
Example 2: max int in a python list
>>> L=[2,-7,3,3,6,2,5]
>>> max(L)
6
Example 3: how to find greatest number in python
Method 1 : Sort the list in ascending order and print the last element in the list.
filter_none
edit
play_arrow
brightness_4
# Python program to find largest
# number in a list
# list of numbers
list1 = [10, 20, 4, 45, 99]
# sorting the list
list1.sort()
# printing the last element
print("Largest element is:", list1[-1])
Output:
Largest element is: 99