The Simplest Way to Reverse Python List – Python Tutorial

By | August 1, 2019

In this tutorial, we will introduce a most simplest method to reverse python list,  you can learn and do by our example code.

Meanwhile, if you want to reverse python string, you can read this tutorial.

Best Practice to Reverse Python String – Python Tutorial

How to reverse python list?

We can use list[::-1] to reverse.

list = [1,2,3,4,5]
list = list[::-1]
print(list)

The output is:

[5, 4, 3, 2, 1]

Leave a Reply