Python Program to Get the Last Element of the List

To understand this example, you should have the knowledge of the following Python programming topics:


Using negative indexing

Output

e

When you use negative indexing, the counting starts from 1 not 0 as shown in the figure below.

Negative Indexing
List indexing in Python

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.