Complete-Python-Mastery icon indicating copy to clipboard operation
Complete-Python-Mastery copied to clipboard

Python program to find second largest number in a list

Open Pankaj-Str opened this issue 2 years ago • 1 comments

Example :  Data [ 10 , 2 , 4 , 5 , 7 , 8 , 9 , 5 ]

Second largest number = 9

Pankaj-Str avatar Aug 19 '23 15:08 Pankaj-Str

Data = [ 10 , 2 , 4 , 5 , 7 , 8 , 9 , 5 ]
Data.sort()
print("Second largest element is:", sorted(Data)[-2])

gghugare avatar Sep 05 '23 10:09 gghugare