reversed() Reverse sequence

Last updated: 2026-09-22

reversed() Reverse sequence

reversed(seq) returns a reverse iterator; works on list, tuple, str, range, etc.

CategoryBuilt-in Functions
KindBuilt-in Function
Python Versionall

📝 Syntax

reversed(sequence)

⚙️ Parameters

sequence RequiredA sequence (list/tuple/str/range, etc.) or an object implementing __reversed__.

Returns:A reverse iterator usable with list() or a for-loop.

💥 Raises

▶ Example

Edit the code, press Run, and see the result in the output panel:

Output:

[3, 2, 1]
o l l e h
More case studies coming soon — check back later.

❓ FAQ

QWhat does reversed() return?
AIt returns a reverse iterator, so you need list(reversed([1, 2, 3])) to get [3, 2, 1]; it is not itself a list.
QWhat is the difference between reversed() and lst[::-1]?
Alst[::-1] returns a new complete list (copying the data, O(n) memory); reversed(lst) is a lazy iterator that copies nothing and is only suitable for traversing once from end to start.
QWhy does reversed({1, 2, 3}) raise a TypeError?
AA set is unordered and has no concept of 'reversal'; reversed() only supports sequences (list/tuple/str/range) or objects implementing __reversed__.
QAre reversed() and sorted(lst, reverse=True) the same?
ANo. reversed keeps the original order and outputs it backwards without sorting; sorted(reverse=True) sorts in descending order. For [3,1,2], the former gives [2,1,3] and the latter [3,2,1].
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏