It is used to insert element in list before specified index.For an instance we want to add element before 2 index in list at hen we we write as shown below.

Example of List.Insert:

a=[‘apple’, ‘orange’, ‘mango’, ‘guavava’]

To Insert element before index 2 or before mango

a.insert(2,’pineapple’)

when you print list a element will have been inserted

how to insert or add element in list at specified index using list.insert
1.List insert

 

By SC

One thought on “List.Insert”

Leave a Reply

Your email address will not be published. Required fields are marked *