Pop

Syntax #

list.pop(pos)

Parameter Values #

| Parameter | Description | | pos | Optional. An int specifying index of item to be removed |

If no pos parameter is passed defaults to removing the last item in the list aka -1.

Example #

fruits = ['apple', 'banana', 'cherry']
fruits.pop(1)
print(fruits)
['apple', 'cherry']