ReferenceList methods
list.insert()
Puts an item at a position, pushing the rest along.
Signature
items.insert(index, item)Parameters
| Name | Means |
|---|---|
index | where it should land |
item | what to put there |
Returns
None.
Example
Python
names = ["Ada", "Kat"]
names.insert(1, "Grace")
print(names)
names.insert(99, "Last")
print(names)Output
['Ada', 'Grace', 'Kat'] ['Ada', 'Grace', 'Kat', 'Last']