Lists: Methods
Inserting an item at a given position
- Syntax: list.insert[index, item]
- E.g.
>>> l = [1, ["2", 4], 3.0]
>>> l.insert(0, 8.3)
>>> l
[8.3, 1, ['2', 4], 3.0]
Adding an item at the end of the list
- Syntax: list.append[item]
- E.g.
>>> l.append(“end”)
>>> l
[8.3, 1, ['2', 4], 3.0, “end”]