Programming Examples
Python program to find the 2nd largest number from the list of the numbers entered through keyboard.
WAP to find the 2nd largest number from the list of the numbers entered through keyboard.
Solution
a=[]
n=int(input("Enter the number of elements : "))
for i in range(1,n+1):
b=int(input("Enter element : "))
a.append(b)
a.sort()
print("Second largest element is : ",a[n-2])
Output
Enter the number of elements : 5
Enter element : 23
Enter element : 45
Enter element : 2
Enter element : 34
Enter element : 1
Second largest element is : 34