Hopefully this clarifies what exactly enumerate does:

>>> list(enumerate('abc'))
[(0, 'a'), (1, 'b'), (2, 'c')]

It just turns your list into a list of a pairs where each of your elements is joined with the index i.e. a with 0, b with 1 and c with 2.

That's not exactly true because it is an iterator rather than an actual list - so it provides you with values lazily when you wrap another iterator.

Looping over it is therefore the same as any other lists except usually it is done the following way:

for i, x in enumerate(xs)

You could still use:

for i in enumerate(xs)

but then just know that i is going to be a tuple with some int, and some object from xs.

Answer from rudolfovic on Stack Overflow
🌐
Real Python
realpython.com › python-enumerate
Python enumerate(): Simplify Loops That Need Counters – Real Python
October 21, 2025 - Python’s enumerate() function helps you with loops that require a counter by adding an index to each item in an iterable. This is particularly useful when you need both the index and value while iterating, such as listing items with their ...
Discussions

For loop Len vs enumerate
Neither is better. Use whichever you like best. Personally I'd use the range() version. More on reddit.com
🌐 r/learnpython
7
5
October 9, 2020
What's the difference between using in vs. in enumerate() with for loops?
enumerate is a built in function that will return the index of the items in the list as you iterate over the list. https://www.google.com/url?sa=t&source=web&rct=j&url=https://docs.python.org/3/library/functions.html&ved=2ahUKEwidrOrnnqj1AhXLJjQIHUv0AssQFnoECDEQAQ&usg=AOvVaw2aflcS7kd-hLXzuZoQl_tg More on reddit.com
🌐 r/learnpython
5
0
January 10, 2022
[deleted by user]
Thanks for the tutorial! More on reddit.com
🌐 r/learnpython
26
171
March 2, 2022
i for i? And the enumerate functions purpose?
It's building a new list as it's iterating an existing one. It's easiest to look at in 3 parts. First part is the loop where the list is read for i,x in enumerate(spikeTrain) using enumerate and thus parsing the index into variable i and the item into variable x. Then in part 2 there's condition if x==1 which filters which items you want to add to your new list. Only items matching this condition are picked. And then lastly in part 3 there's the surrounding list construction with [i ...] where a new list is created and the filtered values are placed. Same could be achieved with: new_list = [] for i, x in enumerate(old_list): if x == 1: new_list.append(i) More on reddit.com
🌐 r/learnpython
9
14
May 23, 2020
People also ask

What does enumerate() do in Python?
enumerate() adds a counter to an iterable, returning pairs of (index, value).
🌐
pythonbasics.org
pythonbasics.org › home › python basics › enumerate explained (with examples)
Enumerate Explained (With Examples) - pythonbasics.org
How do you use enumerate() in a for loop?
for i, val in enumerate(my_list): gives you both the index and value.
🌐
pythonbasics.org
pythonbasics.org › home › python basics › enumerate explained (with examples)
Enumerate Explained (With Examples) - pythonbasics.org
Can you start enumerate() from a number other than 0?
Yes: enumerate(my_list, start=1) starts counting from 1.
🌐
pythonbasics.org
pythonbasics.org › home › python basics › enumerate explained (with examples)
Enumerate Explained (With Examples) - pythonbasics.org
🌐
Great Learning
mygreatlearning.com › blog › it/software development › python enumerate(): simplify looping with counters
Python enumerate(): Simplify Looping With Counters
January 6, 2025 - The simplest and most common way to use the enumerate function is to loop over the iterable object, as shown in the example below: ... In this example, the index represents the current index of the iterable object, and the value represents the ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › enumerate-in-python
Enumerate() in Python - GeeksforGeeks
The enumerate() function in Python is used to iterate over an iterable while keeping track of both the index and the value. It returns pairs in the form (index, element). This removes the need to manually maintain a counter variable during iteration.
Published: May 8, 2026
🌐
Analytics Vidhya
analyticsvidhya.com › home › python enumerate(): simplify looping with counters
Python enumerate(): Simplify Looping With Counters | Analytics Vidhya
July 12, 2024 - When you are writing Python code you can use the enumerate() function to generate a counter for each value of an iterable. This article shows a tutorial about using Python’s Enumerate() method using a for loop.
🌐
Afternerd
afternerd.com › blog › python-enumerate
Python Enumerate Explained (With Examples) - Afternerd
August 20, 2019 - That’s why when we iterate over the enumerate object with a for loop like this: >>> for idx, val in enumerate(['a', 'b']): ... print(idx, val) ... 0 a 1 b · We are effectively unpacking these tuples to an index and a value. But there is nothing that prevents you from doing this (but don’t do it :)) >>> for i in enumerate(['a', 'b']): ... print(i[0], i[1]) ... 0 a 1 b ... Check out the Courses section! The Python Learning Path (From Beginner to Mastery)
Find elsewhere
🌐
Python Basics
pythonbasics.org › home › python basics › enumerate explained (with examples)
Enumerate Explained (With Examples) - pythonbasics.org
You can iterate over a Python list by using enumerate(). Lets see that in a simple example. ... >>> fruits = [ "Apple","Berry","Cherry" ] >>> for i,j in enumerate(fruits): ... print(i,j) ...
🌐
freeCodeCamp
freecodecamp.org › news › python-enumerate-python-enum-for-loop-index-example
Python Enumerate – Python Enum For Loop Index Example
September 22, 2021 - Instead of incrementing a count variable ourselves, we can use the enumerate() function with the for loop. Python's built in enumerate() function takes in an iterable and an optional start argument.
🌐
Medium
medium.com › @datasciencejourney100_83560 › enumerate-function-in-py-1289137117e9
Enumerate Function in Python. The enumerate() function in Python is a… | by Rina Mondal | Medium
August 30, 2025 - # Syntax enumerate(iterable, start=0) ... we use the enumerate() function to iterate over my_list. In each iteration, enumerate() yields a tuple containing the index and value of the current item in the list. We unpack this tuple into index and value variables. Inside the loop, we print the index and value of each item in the list...
🌐
Coursera
coursera.org › tutorials › how to enumerate in python: step by step
How to Enumerate in Python: Step by Step | Coursera
February 24, 2023 - This function enables you to loop over an iterable while accessing the index of items within it. For example, suppose you want to assign a count to each item in the following sequence: ... In that case, you could feed this sequence to the function ...
🌐
Programiz
programiz.com › python-programming › methods › built-in › enumerate
Python enumerate()
We can convert enumerate objects to lists and tuples using list() and tuple() functions, respectively. ... Note: We can change the default counter in enumerate() as per our need. grocery = ['bread', 'milk', 'butter'] for item in enumerate(grocery): print(item) print() # loop over an enumerate ...
🌐
Python Tips
book.pythontips.com › en › latest › enumerate.html
13. Enumerate — Python Tips 0.1 documentation
my_list = ['apple', 'banana', 'grapes', 'pear'] for c, value in enumerate(my_list, 1): print(c, value) # Output: # 1 apple # 2 banana # 3 grapes # 4 pear · An example of where the optional argument of enumerate comes in handy is creating tuples containing the index and list item using a list.
🌐
Vultr Docs
docs.vultr.com › python › built-in › enumerate()
Python enumerate() - Iterate With Index
December 5, 2024 - Use the enumerate() function to iterate through the list, obtaining both index and value. ... fruits = ['apple', 'banana', 'cherry'] for index, fruit in enumerate(fruits): print(f"{index}: {fruit}")
🌐
Towards Data Science
towardsdatascience.com › home › artificial intelligence › looping in python
Looping in Python | Towards Data Science
September 18, 2020 - Instead of using the range() function, we can instead use the built-in enumerate() function in python. enumerate() allows us to iterate through a sequence but it keeps track of both the index and the element.
🌐
Mimo
mimo.org › glossary › python › enumerate-function
Python enumerate Function: Master Index-Based Iteration
Learn basics, data types, control ... any iterable object, such as lists, tuples, or dictionaries. By passing an iterable object to enumerate(), you can pair each element with its index for more efficient looping......
🌐
Nb-Data
nb-data.com › non-brand data › 6 ways to use python's enumerate for better loop control - nbd lite #28
6 Ways to Use Python's enumerate for Better Loop Control - NBD Lite #28
October 14, 2024 - There are situations during our data processing where we would need both the index and value from the list. Without using enumerate, we would need a manual counter that makes the code less efficient. That’s why we could rely on enumerate looping through the index and values. Below is a code example of how to do that. data = ['apple', 'banana', 'cherry'] for i, fruit in enumerate(data): print(f"Index {i}: {fruit}")
🌐
Guru99
guru99.com › home › python › python enumerate() function: loop, tuple & string
Enumerate() Function in Python: Loop, Tuple, String ...
July 10, 2026 - 🔁 Looping: Pair it with a for-loop to read index and value together. 📦 Any iterable: Works on lists, tuples, strings, and dictionaries. 🤖 AI help: Copilot and AI tools autocomplete enumerate() loops and refactor manual counters.
🌐
LearnPython.com
learnpython.com › blog › enumerate-python
The enumerate() Function in Python | LearnPython.com
Before we get started, we should cover some background on the enumerate() function. The syntax looks like this: ... It takes a required iterable like a list, array, or tuple. There’s also an optional argument that defines the start value of the index counter, which defaults to zero. Looping in Python is pretty fundamental, and we’ve previously discussed it in a few places. For some background reading, take a look at How to Write a For Loop in Python.
🌐
Note.nkmk.me
note.nkmk.me › home › python
How to Start enumerate() at 1 in Python | note.nkmk.me
May 6, 2023 - In Python, the built-in function enumerate() allows you to get both the element and index (count) from iterable objects, such as list and tuple, within a for loop. You can start the index at any value ...
🌐
Medium
medium.com › @putra.zakyindras › simplifying-iteration-in-loops-with-phyton-enumerate-81766c39b471
Simplifying Iteration in Loops with Phyton Enumerate() | by Zaky Indra Satria Putra | Medium
November 16, 2023 - The output would be in list ... (i) and values (v). ... Python’s enumerate() lets us write Pythonic for loops when we need a count and the value from an iterable....