← All tips

How to reverse a list in Python

pythonbasics

Use the [::-1] slice notation:

nums = [1, 2, 3]
print(nums[::-1])