AI engineering glossary · Python core

What is enumerate?

enumerate: A built-in function that wraps an iterable and yields pairs of a counter and the item, starting from 0 by default or from a chosen start. It avoids maintaining a separate index variable in loops.

Level: intermediateTopic: Python core

enumerate: an example

for i, name in enumerate(['A', 'B'], start=1): gives (1, 'A') and then (2, 'B').

Related terms

More Python core terms

Where you learn it

enumerate is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.