insert()

The syntax for the insert () method is given as follows:

list1.insert (index1, item) 

index1 is the index where the item needs to be inserted. The item is the value to be inserted into list1:

>>> A = [‘iron-man', 'hulk', 'Thor']

>>> A.insert (0,"Captain-America")

>>> A

['Captain-America', 'iron-man', 'hulk', 'Thor']

>>>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.187.233