In this program, we will take a user input as a list. Find the second largest number from the list with the help of the below-given steps.
Second largest number in a list:
Steps to solve the program
- Take a list as input.
- Sort the list using sort().
- Print the second largest number from the list using indexing.
#Input list
list1 = [22,11,78,45,90,44]
#sorting the list
list1.sort()
#printing the output
print("2nd largest number: ", list1[-2])
Output :
2nd largest number: 78
Related Articles
Python program to find the second smallest number from the list.
Python program to merge all elements of the list in a single entity using a special character.
Python program to get the difference between two lists.
Python program to reverse each element of the list.
Python program to combine two list elements as a sublist in a list.
Python program to get keys and values from the list of dictionaries.