# Create a sample list images = ['house.png', 'street.png', 'forrest.png']
# Get the last item last = images[-1]
# Print the last item print(last)
forrest.png
The -1 index always returns the last item of a Python list. The -2 index would return the item before the last item, and so on.
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.
Subscribe to be the first to know when a new Python course is released.