Lesson 14
Indexes with enumerate
enumerate produces an index and item together, avoiding manual counters. By default indexing starts at zero.
Pass start=1 for human-friendly numbering. The underlying collection does not change.
Use for position, item in enumerate(items) to unpack each pair. This keeps the loop readable and avoids repeated indexing.
for position, item in enumerate(["tea", "water"], start=1):
print(position, item)Check your understanding
What is the default starting index for enumerate?