insert()
Adds an element to a specific position.
Syntax
items.insert(position, element)
Description
Places the element at the given index, shifting the following ones to the right.
Example
Loading editor…
Expected output
[1, 2, 3, 4]
When to use?
Inserting an element into the middle of an ordered list.