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:
Deep Learning with Applications Using Python - Navin Kumar Manaswi
Python Dictionary
Python Set difference_update()
Python Namespace and Scope
Python Set update()
Python Program to Convert Decimal to Binary Using Recursion
Python pow()
Python bytearray()
Python bool()
Python Program to Print all Prime Numbers in an Interval
Python Machine Learning - Sebastian Raschka
Python next()
Python 3 for Absolute Beginners - Tim Hall & J.P Stacey
Python Program to Catch Multiple Exceptions in One Line
Python String rjust()
Machine Learning with Python for everyone - Mark E.Fenner
Python String format()
Python Set isdisjoint()
Python id()
Python List count()
Python String rindex()
Python if...else Statement
Python Set symmetric_difference_update()
Python Functions
Python Program to Check if a Key is Already Present in a Dictionary
Python sleep()
Remove the First Element from a List
Python for Loop
Python Inheritance
Python Program to Add Two Matrices
Python Dictionary pop()
Python all()