Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Use enumerate() when a Python loop needs both an item and its position: for index, item in enumerate(items):. It counts from 0 by default; use enumerate(items, start=1) for one-based labels. The start value changes the counter, not which items the loop visits.
Get each item and its index with enumerate()
enumerate(iterable, start=0) produces pairs containing a count and each value yielded by the iterable. In a for loop, unpack those two parts into separate variables:
names = ["Ada", "Grace", "Linus"]
for index, name in enumerate(names):
print(index, name)
This prints:
0 Ada
1 Grace
2 Linus
The first variable receives the count; the second receives the item. Give the item variable a useful name, such as name, row, or item. Python’s tutorial describes enumerate() as a way to retrieve a sequence’s position and corresponding value together (Python tutorial: Looping Techniques).
Use start=1 for one-based labels
By default, the count begins at 0. To number output for people starting at 1, pass start=1:
Recommended Free Tools
#1 Best Overall
names = ["Ada", "Grace", "Linus"]
for number, name in enumerate(names, start=1):
print(number, name)
The output is:
1 Ada
2 Grace
3 Linus
Here, number is a one-based label, not the item’s conventional zero-based sequence index. A descriptive name can prevent confusion when the value is for display, such as line_number or number. The built-in reference documents the signature enumerate(iterable, start=0) and explains that the counter begins at start while values are obtained from the iterable (Python built-in functions: enumerate()).
Does start=1 skip the first item?
No. start initializes the count; it does not select an item offset. enumerate(items, start=1) still visits the first item and labels it 1. The documented equivalent initializes a counter to start and then iterates over the iterable, which is why changing the count does not skip values (Python built-in functions: enumerate()).
Rank #2
If you need to begin at a later item, change the iterable being looped over—for example, use a slice for a sequence:
for index, item in enumerate(items[2:], start=2):
print(index, item)
This example starts with the third item of a sliceable sequence and labels it with its original zero-based position. Slicing creates a separate slice; for other iterable types, choose an appropriate iterator operation instead.
Choose the loop that matches what you need
| Need | Use | Example |
|---|---|---|
| Only the values | A value-only loop | for item in items: |
| Each value and its zero-based position | enumerate() with its default start |
for index, item in enumerate(items): |
| Each value and a one-based display label | enumerate() with start=1 |
for number, item in enumerate(items, start=1): |
| Iteration beginning at a later item | Adjust the iterable, separately from the counter | enumerate(items[2:], start=2) for a sliceable sequence |
If the loop never uses the position, a plain value-only loop is simpler. Use enumerate() when both the count and item are useful; it avoids maintaining a separate counter by hand.
Common enumerate() mistakes
- Expecting
startto skip values: It changes the first count only. Adjust the iterable when the loop should begin later. - Unpacking the wrong shape: Each iteration yields a count and an item. Unpack them into two variables, or bind the pair to one variable if you need it as a pair.
- Using a manual counter without a reason: A separate counter requires updating and maintaining extra state. Prefer
enumerate()when you need both the count and the value. - Getting an index when you only need an item: Use
for item in items:if the position is irrelevant. - Calling a one-based label an index: When you pass
start=1, the count is useful for numbering, but it is not the usual zero-based position.
For iterable mutation or other behavior specific to a collection, consult that iterable’s documentation; enumerate() supplies counts alongside values but does not by itself establish general mutation guarantees.
Quick Recap
Best Value
Python documentation
- Python 3.14.8 built-in functions documentation: enumerate()
- Python tutorial: Data Structures, Looping Techniques
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




