insert()
` method of the list object. The `insert()
` method takes two arguments : the first argument is the index where you want to add the item, and the second argument is the item itself.my_list = ["apple", "banana", "cherry"]
# Add "orange" at index 1
my_list.insert(1, "orange")
print(my_list)
['apple', 'orange', 'banana', 'cherry']
my_list
` with three items: "apple", "banana", and "cherry". Then, we use the `insert()
` method to add the item "orange" at index 1, which pushes "banana" and "cherry" one index to the right. Finally, we print the updated list using the `print()
` function.