Syntax:
list.insert(index, element)
Here,
- list is the name of the list, in which we have to insert element at given index.
- index is the position, where we want to insert an element.
- element is an element/item to be inserted in the list.
Example:
list.insert(2, 100)
It will insert 100 at 2nd position in the list name ‘list’.
Program:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer