How to Reverse a List in Python?

Summary: There are only three best ways to reverse the order of the list elements:

list.reverse() — Best if you want to reverse the elements of list in place.list[::-1] — Best if you want to write concise code to return a new list with reversed elements.reversed(list) — Best if you want to iterate over all elements of a list in reversed order without changing the original list.

The method list.reverse() can be 37% faster than reversed(list) because no new object has to be created.

When I read over code from my students, I often realize that they know one or two ways of

Continue reading the original article