when you are using for loop with a list. It includes all the elements in the list starting from the zero'th: if f=['x','y','z']

for i, word in enumerate(f):
    print i, word

would output:

0 x
1 y
2 z

for printing every 30th line. You can use

for i in range(0,390,30):

which would output: 0, 30 ,60 90, ...

Answer from Ashoka Lella 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 ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › enumerate-in-python
Enumerate() in Python - GeeksforGeeks
Explanation: list(enumerate(a)) converts index-element pairs into a list of tuples. Example 2: This code retrieves elements one by one using next() on enumerate object. ... Explanation: next(e) returns the next (index, element) pair.
Published: May 8, 2026
Discussions

Is there any reason to use enumerate to get index of items and print them?
The enumerate version avoids you needing to do list[i] to get the element, which is slightly cleaner. Use of enumerate says "I potentially need both the element and the index in the loop". It's purely for cleanliness and semantics. More on reddit.com
🌐 r/learnpython
17
0
June 25, 2025
using the 'enumerate' function to iterate over a list with index and value
Enumerate is a generator. Like when you call range() in a loop. They yield values. More on reddit.com
🌐 r/pythontips
4
10
March 25, 2024
A desperate plea for help (StackOverflow did not help)

why you expect StackOverflow to help when there is not clear clarity in your problem? I mean you didn't even mentioned the sequence conditions, why do you expect SO to help on this?

More on reddit.com
🌐 r/learnpython
85
60
November 30, 2021
[deleted by user]
Thanks for the tutorial! More on reddit.com
🌐 r/learnpython
26
171
March 2, 2022
🌐
Vultr Docs
docs.vultr.com › python › built-in › enumerate()
Python enumerate() - Iterate With Index
December 5, 2024 - Start with an initial list of numerical values. Use enumerate() to iterate over the list and apply modifications based on the index.
🌐
Mimo
mimo.org › glossary › python › enumerate-function
Python enumerate Function: Master Index-Based Iteration
The enumerate() function in Python provides a cleaner way to access both the index and the value of elements during iteration. Using enumerate() allows you to access both the item and its index in a list.
🌐
Afternerd
afternerd.com › blog › python-enumerate
Python Enumerate Explained (With Examples) - Afternerd
August 20, 2019 - Python gives you the luxury of iterating directly over the values of the list which is most of the time what you need. However, there are times when you actually need the index of the item as well. Python has a built-in function called enumerate that allows you to do just that.
🌐
Finxter
blog.finxter.com › python-enumerate-efficiently-retrieve-list-elements-with-index
Python enumerate(): Efficiently Retrieve List Elements with Index – Be on the Right Side of Change
August 18, 2023 - The enumerate() function can be combined with different list operations, such as slicing or filtering, to get the index and element for specific situations. Strings are sequences of characters and can be treated like lists when using enumerate(). You can iterate over a string, capturing the ...
Find elsewhere
🌐
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 ...
🌐
Reddit
reddit.com › r/pythontips › using the 'enumerate' function to iterate over a list with index and value
r/pythontips on Reddit: using the 'enumerate' function to iterate over a list with index and value
March 25, 2024 -

Suppose you want to iterate over a list and access both the index and value of each element.

You can use this code:

# Original list
lst = ['apple', 'banana', 'cherry', 'grape']

# Iterate over the list with index and value
for i, fruit in enumerate(lst):
    print(f"Index: {i}, Value: {fruit}")

# Output
# Index: 0, Value: apple
# Index: 1, Value: banana
# Index: 2, Value: cherry
# Index: 3, Value: grape

The enumerate function returns a tuple containing the index and value of each element, which can be unpacked into separate variables using the for loop.

🌐
Trey Hunner
treyhunner.com › 2016 › 04 › how-to-loop-with-indexes-in-python
How to loop with indexes in Python
April 25, 2016 - This first creates a range corresponding to the indexes in our list (0 to len(colors) - 1). We can loop over this range using Python’s for-in loop (really a foreach). This provides us with the index of each item in our colors list, which is the same way that C-style for loops work.
🌐
Codefinity
codefinity.com › courses › v2 › a8aeafab-f546-47e9-adb6-1d97b2927804 › 67140d04-48dc-4e46-b3fb-fcdf181555ec › 2e32bde6-e7c1-4f4b-9cca-74c1c0a1ca14
Codefinity: Courses with certificates | Online Learning Platform
The enumerate() function makes it easy to retrieve both the index and the value simultaneously. ... index: refers to the position of an element in the list. Python uses 0-based indexing, meaning the first element has an index of 0;
🌐
BelieveMy
believemy.com › python glossary › enumerate
Enumerate in Python: iterate with index easily | Python glossary
February 4, 2026 - With enumerate(), the code is more concise, more readable, and less error-prone. This is the idiomatic way to loop through a sequence with its index in Python. By default, the counter starts at 0, but you can specify a different starting value ...
🌐
Great Learning
mygreatlearning.com › blog › it/software development › python enumerate(): simplify looping with counters
Python enumerate(): Simplify Looping With Counters
January 6, 2025 - You can use Python Enumerate Function to specify a different starting index value by adding the second parameter. my_list = ['apple,' 'banana,' 'cherry,' 'date'] for index, item in enumerate(my_list, start=1): print(index, item) The output will ...
🌐
Coursera
coursera.org › tutorials › how to enumerate in python: step by step
How to Enumerate in Python: Step by Step | Coursera
February 24, 2023 - Here’s how the enumerate function ... (the default): enumerate() takes a list called "fruits" as an argument and returns an enumerate object, which contains pairs of indices and corresponding items from the list....
🌐
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.
🌐
DEV Community
dev.to › lifeportal20002010 › python-for-loops-with-index-mastering-the-enumerate-function-1eim
Python for Loops with Index: Mastering the enumerate() Function - DEV Community
January 30, 2026 - The most recommended way to get both the index and the element in a loop is by using the built-in enumerate() function. It eliminates the need to track a counter manually or call len() on your list...
🌐
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 - The enumerate() function in Python is a built-in function that allows you to iterate over an iterable (such as a list, tuple, or string) while also keeping track of the index of each item in the iterable.
🌐
Enki
enki.com › post › what-does-enumerate-mean-in-python
Enki | Blog - What Does enumerate Mean in Python
In this tutorial, we will uncover ... and value simultaneously. The enumerate() function is a Python tool that allows you to loop through an iterable—like a list, tuple, or string—and have access to both the index and the element itself....