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.
![List indexing in Python Negative Indexing](/sites/tutorial2program/files/python-list-index.png)
If you want the first 1st element, you can use my_list[-5]
.
Also Read: