How to reverse a Python List
Reverse the elements in a list
The reverse
method reverses the elements
in a list. It changes the list in place
and returns nothing. reverse method has the
following syntax.
alist.reverse()
Reverses items inalist
in-place.
x = [1, 2, 3]
x.reverse()
print x
The code above generates the following result.