+ 5
insert() is an inbuilt function in Python that inserts a given element like numbers at a given index in a list.
Example:
number = [1, 2, 3, 4]
number.insert(2, 6)
print(number)
+ 5
Just an additional to Dino Wun (Use the search bar plz!) said.
The output will become
>> [1, 2, 6, 3, 4]
The first parameter is the index and the second parameter is the element
list.insert(index, element)
The element which is in that same index of the original list will not be replaced but rather will be moved to the right.
+ 3
Please avoid writing the question in the tags ☝



