What is the syntax to reverse a list?

<list name>.reverse()
#example
>>> nums = [1,2,3,4,5]
>>> nums.reverse()
>>> nums
[5, 4, 3, 2, 1]

 

Advertisements