Python Lists – Get list in reverse order

In this post we will be iterating over a Python list in reverse order, lists in Python are a means of storing multiple pieces of data in to a single variable. In order to iterate a list in reverse we will be making use of Pythons inbuilt ‘reversed()’ function which will return an iterable in reverse.

See the below list we will be using for this example.

List=['Harry', 'John', 'Raj', 'Amy', 'Leah']

See the snippet of code below that will print the above list in reverse order.

List=['Harry', 'John', 'Raj', 'Amy', 'Leah']

The above will return the following as output.

['Leah', 'Amy', 'Raj', 'John', 'Harry']

Leave a Reply