enumerate() Enumerated iterator

Last updated: 2026-09-22

enumerate() Enumerated iterator

enumerate(iterable, start=0) yields (index, item) pairs, useful in for-loops.

CategoryBuilt-in Functions
KindBuilt-in Function
Python Versionall

📝 Syntax

enumerate(iterable[, start])

⚙️ Parameters

iterable RequiredThe iterable to enumerate.
start OptionalThe starting index.(Default:0)

Returns:An enumerate iterator yielding (index, item) tuples.

💥 Raises

▶ Example

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

Output:

1 apple
2 banana
More case studies coming soon — check back later.

❓ FAQ

QWhat is the start parameter of enumerate() for?
AIt sets the starting index; enumerate(lst, start=1) counts from 1, useful when you want a 1-based index for display.
QDoes enumerate() return a list?
ANo, it returns an enumerate object (a lazy iterator); when needed, use list(enumerate(lst)) to obtain [(0, 'a'), (1, 'b')].
QHow do I use enumerate in a for loop?
Afor i, item in enumerate(lst): unpacks the index and the element directly — more Pythonic than maintaining a counter variable by hand.
QHow do I iterate two lists while also needing the index?
ACombine with zip: for i, (a, b) in enumerate(zip(x, y)): gives you the index and both elements at once.
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%

🙏 帮我们做得更好

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

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