In this example we will show how to add an item to the list at the specified index in Python.
Source Code
my_list = ['a', 'b', 'c', 'd', 'e']
my_list.insert(2, 'f')
print(my_list)
Output:
['a', 'b', 'f', 'c', 'd', 'e']
In this example we will show how to add an item to the list at the specified index in Python.
my_list = ['a', 'b', 'c', 'd', 'e']
my_list.insert(2, 'f')
print(my_list)
Output:
['a', 'b', 'f', 'c', 'd', 'e']