examples/lists/pop.py
from __future__ import print_function

planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn']
print(planets)          # ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn']

last = planets.pop()
print(last)             # Saturn
print(planets)          # ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter']

third = planets.pop(2)
print(third)            # Earth
print(planets)          # ['Mercury', 'Venus', 'Mars', 'Jupiter']

Remove and return the last element of a list. Throws an exception if the list was empty.