enumerate()
noun
say it: “ih-NOO-muh-rayt” /ɪˈnuməˌreɪt/
A Python function that gives each item in a loop together with its position number, starting from 0 or a number you choose.
What does enumerate() do?
enumerate() gives you each item in a loop together with its position number.
for place, runner in enumerate(["Mia", "Jon", "Ava"], start=1):
print(place, runner) # 1 Mia, 2 Jon, 3 Ava
In a sentence
- “Looping with enumerate gives the index and the song together.”
- “enumerate numbered the runners 1, 2 and 3 with start=1.”
Level: Apprentice · More Python terms at this level
Updated