ReferenceList methods
list.pop()
Removes the item at a position and hands it back.
Signature
items.pop(index=-1)Parameters
| Name | Means |
|---|---|
index | which one; the last when omitted |
Returns
The removed item. Raises IndexError when out of range.
Example
Python
names = ["Ada", "Grace", "Kat"]
print(names.pop())
print(names.pop(0))
print(names)Output
Kat Ada ['Grace']