> For the complete documentation index, see [llms.txt](https://sisyphus.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sisyphus.gitbook.io/project/python-notes/python-reverse-a-list.md).

# Python reverse a list

You can make use of the [`reversed`](https://www.python.org/dev/peps/pep-0322/) function for this as:

```
>>> array=[0,10,20,40]
>>> for i in reversed(array):
...     print(i)
```

Note that `reversed(...)` does not return a list. You can get a reversed list using `list(reversed(array))`.

According to the  above link to, "Compared to extended slicing, such as range(1,4)\[::-1], reversed() is **easier to read, runs faster, and uses substantially less memory.**&#x20;
