🌐
W3Schools
w3schools.com › python › ref_func_enumerate.asp
Python enumerate() Function
Python Sets Access Set Items Add Set Items Remove Set Items Loop Sets Join Sets Frozenset Set Methods Set Exercises Code Challenge Python Dictionaries
🌐
w3resource
w3resource.com › python › built-in-function › enumerate.php
Python enumerate() function - w3resource
Example: Looping Over an Enumerate object · Fruits = ['Apple', 'Mango', 'Orange'] for item in enumerate(Fruits): print(item) print('\n') for count, item in enumerate(Fruits): print(count, item) print('\n') # changing default start value for count, item in enumerate(Fruits, 50): print(count, item) Output: (0, 'Apple') (1, 'Mango') (2, 'Orange') 0 Apple 1 Mango 2 Orange 50 Apple 51 Mango 52 Orange · Python Code Editor: Previous: divmod() Next: eval() Test your Python skills with w3resource's quiz  ·
🌐
Programiz
programiz.com › python-programming › methods › built-in › enumerate
Python enumerate()
grocery = ['bread', 'milk', 'butter'] for item in enumerate(grocery): print(item) print() # loop over an enumerate object for count, item in enumerate(grocery): print(count, item) print()
🌐
Towards Data Science
towardsdatascience.com › home › latest › looping in python
Looping in Python | Towards Data Science
January 20, 2025 - In this tutorial, we learned how the enumerate() function is used to count through an iterable. ... Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program. Write for TDS
🌐
GeeksforGeeks
geeksforgeeks.org › python › enumerate-in-python
Enumerate() in Python - GeeksforGeeks
Explanation: list(enumerate(a)) converts index-element pairs into a list of tuples.
Published   July 12, 2017
🌐
Real Python
realpython.com › python-enumerate
Python enumerate(): Simplify Loops That Need Counters – Real Python
June 23, 2025 - Learn how to simplify your loops with Python’s enumerate(). This tutorial shows you how to pair items with their index cleanly and effectively using real-world examples.
🌐
freeCodeCamp
freecodecamp.org › news › python-enumerate-python-enum-for-loop-index-example
Python Enumerate – Python Enum For Loop Index Example
September 22, 2021 - In this article, I will show you how to use Python's enumerate() function with a for loop and explain why it is a better option than creating your own incrementing counter.
🌐
Great Learning
mygreatlearning.com › blog › it/software development › python enumerate(): simplify looping with counters
Python enumerate(): Simplify Looping With Counters
January 6, 2025 - The Python Enumerate Function is a built-in function in Python that adds a counter to an iterable object and returns an enumerate object. The enumerate function can be used directly for loops to keep track of the iteration of the loop.
Find elsewhere
🌐
W3Schools
w3schools.com › python › python_for_loops.asp
Python For Loops
Python Examples Python Compiler ... Interview Q&A Python Bootcamp Python Certificate Python Training ... A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a stri...
🌐
W3Schools
w3schools.com › python › python_lists_loop.asp
Python - Loop Lists
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... Learn more about for loops in our Python For Loops Chapter.
🌐
Sololearn
sololearn.com › en › Discuss › 1899313 › for-loop-including-enumerate-methodpython
For loop including enumerate method(Python) | Sololearn: Learn to code for FREE!
So just some more information about ... like 2 for first iteration, 4 for second iteration ... now you can use p and n to do something during each iteration loop......
🌐
Reddit
reddit.com › r/learnpython › struggling to understand for loops in python
r/learnpython on Reddit: Struggling to understand for loops in Python
September 9, 2025 -

Hey everyone, I’m learning Python and I feel really stuck when it comes to for loops. I understand the basic syntax like:

for i in range(5):
    print(i)

But when I try to apply loops to real problems, I get confused. For example, looping through a list or using range with different start/stop/step values trips me up. Sometimes I don’t know when to use for item in list versus for i in range(len(list)).

It feels like I understand loops in isolation but not how to use them properly in practical code.

Can someone explain in a simple way how to think about for loops, and maybe give me some beginner-friendly challenges/exercises so I can practice the right way?

Thanks a lot!

Top answer
1 of 5
10
If we stay with the example of a list, think of it this way: Imagine you have a list with elements [a,b,c] And you need to loop through the list for some action The question then is, do you need the actual elements, for example because you want to validate them or something? In that case going with the actual element in "for i in list" is the way to go. However, if you need the indexes of the items, for example for comparing or checking where in an ordered list items are, going with "for i in range(len(list))" is the way to go, as it allows you to check the current element of the list with a simple "list[i]" while being able to do something with the index itself. Ideally very often you would use something more descriptive than "i" if you need to do a bigger operation with it in order to makeit clear to the reader of your code what the selected item/index is for Please excuse my poor code formatting, I am on mobile, but I hope this helped you a little.. TLDR: It depends on use case which way to use for loops
2 of 5
4
For the most part it's a matter of convenience and practicality. Let's say you have some kids in a line, and you want to say good morning to each one. Then you would just iterate over their names. But let's say that you also want to give a present to each one, and you need to give the first gift to the first kid, the second gift to the second kid, and so on... Then you can just use the number, and you'd use the same number both for the kids and the gifts. If you're cool you can use enumerate too.
🌐
Noble Desktop
nobledesktop.com › enumerate function in python
Enumerate Function in Python - Free Video Tutorial and Guide
June 5, 2025 - If it's too technical, there are many other sources like W3schools and Programmers. Python comes with 67-68 built-in functions and the one we're about to use is enumerate. Let me show you how it works. So here I have a word and in my previous video I was using the range function to generate an index for ...
🌐
PyTutorial
pytutorial.com › python-enumerate-function-guide-for-loops
PyTutorial | Python Enumerate Function Guide for Loops
February 5, 2026 - Learn how to use Python's enumerate function to get index and value in loops, with examples for beginners on syntax, parameters, and practical applications.
🌐
Stack Abuse
stackabuse.com › guide-to-enumerate-in-python-forget-loops-with-counters
Guide to enumerate() in Python - Easy for Loops with Counting
January 31, 2022 - In this tutorial, learn how to use the enumerate() function in Python. Loop through lists, tuples and strings with an index for each element automatically!
🌐
Python Basics
pythonbasics.org › enumerate
Enumerate Explained (With Examples) - Python Tutorial
This lets you get the index of an element while iterating over a list. In other programming languages (C), you often use a for loop to get the index, where you use the length of the array and then get the index using that. That is not Pythonic, instead you ...
🌐
Career Karma
careerkarma.com › blog › python › enumerate python: step-by-step guide
Enumerate Python: Step-by-Step Guide | Career Karma
December 1, 2023 - In context, when you loop through a list of employee names, you are iterating through the list. When you create a for loop or another type of loop in Python, you iterate through a set of values.
🌐
Python.org
discuss.python.org › python help
Enumerate explanation - Python Help - Discussions on Python.org
August 23, 2022 - I was trying to find a way to iterate through a string and return a specific character when only unique characters of the string were detected and another character if duplicates were detected (basically encoding the word “cheese” into “(())()” I started diving into nested loops with counts and sets and trying to figure out how to then produce one character or another depending on which list the iteration was found in, but I came across “enumerate”, which from what I’ve read has the ability to...
🌐
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.