In this example, you will learn to get the last element of this list.
To understand this example, you should have the knowledge of the following Python programming topics:
Using negative indexing
my_list = ['a', 'b', 'c', 'd', 'e'] # print the last element print(my_list[-1])
Output
e
When you use negative indexing, the counting starts from 1 not 0 as shown in the figure below.

If you want the first 1st element, you can use my_list[-5].
If you want to learn more, please go to Python list Negative Indexing.
Related posts:
Python Generators
Python String count()
Python String upper()
Python String center()
Python Program to Swap Two Variables
Python time Module
Python String split()
Python Closures
Python Statement, Indentation and Comments
Python String istitle()
Python for Loop
Python Operator Overloading
Python Program to Check Leap Year
Python min()
Python hash()
Python Modules
Python break and continue
Python Program to Compute the Power of a Number
Finding Max/Min of a List or Collection
Python Operators
Python bytes()
Python while Loop
Python String isupper()
Python next()
Python Dictionary keys()
Python String isspace()
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants
Python String format_map()
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python Tuple
Python Set copy()