Reverse indexing in Python | Example code

Reversing indexing of list in reverse the List in Python. It could do easily done by using Slice Notation in python.


Example reverse indexing in Python

Simple example code, Reverse a list.

list1 = [1, 2, 3, 4, 5, 6, 0]
reverse = list1[::-1]


Another solution using reversed instead of slicing with [::-1]:

list1 = [1, 2, 3, 4, 5, 6, 0]
inverse_items = []

for item in reversed(list1):



Reverse indexing in Python

Reverse string using Reverse indexing in Python

str1 = "Python"

Output: nohtyP

Do comment if you have any doubts and suggestions on this Python index topic.

Note: IDE: PyCharm 2021.1.3 (Community Edition)

Windows 10

Python 3.7

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.