Second largest element from a list/array in python


 

The second largest element of an array in python by creating function

In [1]:
Enter the size of the array: 5
Enter  5  elements: 
10
5
6
5
6
Second largest value of the array is:  6

Finding the second largest by applying the sort() function

In [2]:
Enter the size of the list: 5
Enter  5  elements: 
8
4
5
5
6
Second largest is:  6

No comments:

Post a Comment