# python find largest value in list

posted Feb 21

Overview largest value

In this instructional exercise, We will see in our website kodlogs how we can find the value of big and small in python .There are many ways to do this .It has become very easy to learn programming since python came. different Python projects to locate the biggest number in top notch. For instance, on the off chance that the rundown is [20,40,60,80,10,90,100] the yield of the program ought to be 100 (the biggest number in the given rundown)

Largest no in a List.

.Given elite of numbers, the undertaking is to compose a Python program to locate the biggest number in given llist..

``````>>>input :list1=[10,20,30,40,50]

o/p
50``````

Sort( ) Method

In the accompanying project we are utilizing the sort() capacity to locate the biggest number in the given rundown. A rundown of numbers is given in the program and we are arranging the given rundown utilizing sort() work, which sorts the rundown in rising request. We are then showing the last component of the rundown, which is the biggest number in the arranged rundown.

``````List1=[10,20,30,40,50,45,100]
List1.sort( )
print("largest element is:",list1[-1])

O/P
largest element is:100``````

Max( ) Method

``````>>>list1 = [10, 20, 30 ,40, 50 ,60]

>>>print("Largest element is:", max(list1))
O/P

Largest elements is:60``````

provided by user.

``````list1 = []

num = int(input("enter number of elements in list: "))

for i in range(1, num + 1):
ele = int(input("enter elements: "))
list1.append(ele)

print("largest element is:", max(list1)) ``````

OUTPUT

``````Enter number of elements in list: 4
Enter elements: 10
Enter elements: 20
Enter elements: 30
Enter elements: 40
Largest element is: 40``````

using two lists

``````list1,list2[456,'JKL','mno','Kodlogs','abcd'],[123,456,78]
print"Max value element:",max(list1)
print"Max value element:",max(list2)
``````

OUTPUT

``````Max value element:kodlogs
Max value element:456``````

I hope you are understand largest no in python with kodlogs.

110 points
7