How to Access List Items with Negative Indexing in Python


In this example, we will learn how to access the list items by referring to the negative indexing in Python.

Source Code

my_list = ['a', 'b', 'c', 'd', 'e']
print(my_list[-2])

Output:

d
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments