30. Problem to find the second smallest number from the list.

In this program, we will take a user input as a list. Find the second smallest number from the list with the help of the below-given steps.

Second smallest number in a list:

Steps to solve the program
  1. Take a list as input.
  2. Sort the list using sort().
  3. Print the second smallest number from the list using indexing.
				
					#Input list
list1 = [22,11,78,45,90,44]

#Sorting the list
list1.sort()

#Printing output
print("2nd smallest number: ", list1[1])
				
			

Output :

				
					2nd smallest number:  22
				
			

Related Articles

Find the second largest number from the list

Merge all elements using special character

Leave a Comment