57. Problem to insert items in the list at a specific location.

In this Python list program, we will take a user input as a list and insert items in the list at a specific location with the help of the below-given steps.

Insert items in the list:

Steps to solve the program
  1. Take a list as input.
  2. Insert an element at a specific location using the insert function.
  3. Print the output to see the result.
				
					#Input list
list1 = [2, 4, 6, 8, 3, 22]

#iserting element
list1.insert(3,55)

#Printing output
print(list1)
				
			

Output :

				
					[2, 4, 6, 55, 8, 3, 22]
				
			

Related Articles

Split a given list into two parts

Select random numbers from the list

Leave a Comment