You can use slicing:

for item in some_list[2:]:
    # do stuff

This will start at the third element and iterate to the end.

Answer from Björn Pollex on Stack Overflow
🌐
Python Guides
pythonguides.com › python-for-loop-index
How to Use Python For Loop with Index
October 14, 2025 - Learn how to use the Python for loop with index using five easy methods. Includes examples with enumerate(), range(), zip(), and NumPy for real-world coding.
Discussions

Why iterate over an array using the index?
You do it if there is something in your loop that will use an index rather than the elements of the array. For instance, sometimes you want to sample something from another array that is not your loop array A cleaner way to do it is by using enumerate function for i, item in enumerate(array): The index gets assigned to i and whatever element of the array gets assigned to item. This may also be a bad habit from Matlab, people that come from Matlab are more used to looping over indexes. More on reddit.com
🌐 r/learnpython
57
46
April 22, 2023
When using for loops are we iterating through the index or the actual values?
A "pure" for loop requires an index because you're just executing the same piece of code for whatever the range of that index is. What you're probably looking for is a foreach loop, which is really just syntactic sugar over a for loop that allows you to specify iterating over every member of a collection without defining an index. In Python it's a little different than a lot of other languages as there's no explicit foreach keyword. You just define your loop like: for season in seasons: More on reddit.com
🌐 r/learnprogramming
14
0
March 8, 2023
Can a for loop start somewhere other than 0?
Sure, slice the list: for x in l[2:]: More on reddit.com
🌐 r/learnpython
60
113
June 21, 2022
Looping until the second to last element in a list, what's best practice?
for item in the_list[:-1] More on reddit.com
🌐 r/learnpython
23
3
January 11, 2024
Top answer
1 of 16
9261

Use the built-in function enumerate():

for idx, x in enumerate(xs):
    print(idx, x)

It is non-Pythonic to manually index via for i in range(len(xs)): x = xs[i] or manually manage an additional state variable.

Check out PEP 279 for more.

2 of 16
1371

Using a for loop, how do I access the loop index, from 1 to 5 in this case?

Use enumerate to get the index with the element as you iterate:

for index, item in enumerate(items):
    print(index, item)

And note that Python's indexes start at zero, so you would get 0 to 4 with the above. If you want the count, 1 to 5, do this:

count = 0 # in case items is empty and you need it after the loop
for count, item in enumerate(items, start=1):
    print(count, item)

Unidiomatic control flow

What you are asking for is the Pythonic equivalent of the following, which is the algorithm most programmers of lower-level languages would use:

index = 0            # Python's indexing starts at zero
for item in items:   # Python's for loops are a "for each" loop 
    print(index, item)
    index += 1

Or in languages that do not have a for-each loop:

index = 0
while index < len(items):
    print(index, items[index])
    index += 1

or sometimes more commonly (but unidiomatically) found in Python:

for index in range(len(items)):
    print(index, items[index])

Use the Enumerate Function

Python's enumerate function reduces the visual clutter by hiding the accounting for the indexes, and encapsulating the iterable into another iterable (an enumerate object) that yields a two-item tuple of the index and the item that the original iterable would provide. That looks like this:

for index, item in enumerate(items, start=0):   # default is zero
    print(index, item)

This code sample is fairly well the canonical example of the difference between code that is idiomatic of Python and code that is not. Idiomatic code is sophisticated (but not complicated) Python, written in the way that it was intended to be used. Idiomatic code is expected by the designers of the language, which means that usually this code is not just more readable, but also more efficient.

Getting a count

Even if you don't need indexes as you go, but you need a count of the iterations (sometimes desirable) you can start with 1 and the final number will be your count.

count = 0 # in case items is empty
for count, item in enumerate(items, start=1):   # default is zero
    print(item)

print('there were {0} items printed'.format(count))

The count seems to be more what you intend to ask for (as opposed to index) when you said you wanted from 1 to 5.


Breaking it down - a step by step explanation

To break these examples down, say we have a list of items that we want to iterate over with an index:

items = ['a', 'b', 'c', 'd', 'e']

Now we pass this iterable to enumerate, creating an enumerate object:

enumerate_object = enumerate(items) # the enumerate object

We can pull the first item out of this iterable that we would get in a loop with the next function:

iteration = next(enumerate_object) # first iteration from enumerate
print(iteration)

And we see we get a tuple of 0, the first index, and 'a', the first item:

(0, 'a')

we can use what is referred to as "sequence unpacking" to extract the elements from this two-tuple:

index, item = iteration
#   0,  'a' = (0, 'a') # essentially this.

and when we inspect index, we find it refers to the first index, 0, and item refers to the first item, 'a'.

>>> print(index)
0
>>> print(item)
a

Conclusion

  • Python indexes start at zero
  • To get these indexes from an iterable as you iterate over it, use the enumerate function
  • Using enumerate in the idiomatic way (along with tuple unpacking) creates code that is more readable and maintainable:

So do this:

for index, item in enumerate(items, start=0):   # Python indexes start at zero
    print(index, item)
🌐
W3Schools
w3schools.com › python › python_lists_loop.asp
Python - Loop Lists
Learn more about for loops in our Python For Loops Chapter. You can also loop through the list items by referring to their index number. Use the range() and len() functions to create a suitable iterable.
🌐
Trey Hunner
treyhunner.com › 2016 › 04 › how-to-loop-with-indexes-in-python
How to loop with indexes in Python
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. To get the actual color, we use colors[i]. Both the while loop and range-of-len methods rely on looping over indexes. But we don’t actually care about the indexes: we’re only using these indexes for the purpose of retrieving elements from our list.
🌐
LabEx
labex.io › tutorials › python-how-to-iterate-with-index-in-python-419446
How to iterate with index in Python | LabEx
This tutorial explores various methods to access both elements and their corresponding indices during iteration, providing essential skills for writing clean and effective Python code.
🌐
Programiz
programiz.com › python-programming › examples › index-for-loop
Python Program to Access Index of a List Using for Loop
To understand this example, you should have the knowledge of the following Python programming topics: ... Using enumerate(), we can print both the index and the values. Pass two loop variables index and val in the for loop. You can give any name to these variables. Print the required variables inside the for loop block. The function of enumerate() is to add a counter (i.e. index) to the iterate and return it. my_list = [21, 44, 35, 11] for index, val in enumerate(my_list, start=1): print(index, val)
🌐
Vultr
docs.vultr.com › python › examples › access-index-of-a-list-using-for-loop
Python Program to Access Index of a List Using for Loop | Vultr Docs
November 25, 2024 - Iterate over the list and print each item's index starting from your chosen number. python Copy · fruits = ['apple', 'banana', 'cherry'] for index, fruit in enumerate(fruits, start=1): print(f"Index: {index}, Fruit: {fruit}") Explain Code · ...
Find elsewhere
🌐
Python Morsels
pythonmorsels.com › looping-with-indexes
Looping with indexes - Python Morsels
October 8, 2020 - >>> favorite_fruits = ["jujube", "pear", "watermelon", "apple", "blueberry"] >>> >>> for item in enumerate(favorite_fruits, start=1): ... print(item) ... (1, 'jujube') (2, 'pear') (3, 'watermelon') (4, 'apple') (5, 'blueberry') Each tuple has a number (counting upward) and the next item from our favorite_fruits iterable. We could index this tuple, using item[0] and item[1], to grab these two values:
🌐
GeeksforGeeks
geeksforgeeks.org › python › iterate-over-a-list-in-python
Iterate over a list in Python - GeeksforGeeks
This method allow us to access elements by their index, which is useful if we need to know the position of an element or modify the list in place. Python · a = [1, 3, 5, 7, 9] # Calculate the length of the list n = len(a) # Iterates over the indices from 0 to n-1 (i.e., 0 to 4) for i in range(n): print(a[i]) Output ·
Published   December 27, 2025
🌐
Quora
quora.com › How-do-you-iterate-over-a-list-and-pull-element-indices-at-the-same-time
How to iterate over a list and pull element indices at the same time - Quora
Answer (1 of 8): Adding to the correct answer by User-12748610390850255192, there is an optional start argument to the enumerate function, which I find very helpful when I need to count from 1 or any other number instead of 0. [code]for index, value in enumerate(numbers, start=1): print 'The ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python – access index in for loop with examples
Python - Access Index in For Loop With Examples - Spark By {Examples}
May 31, 2024 - In the below example, the start=1 parameter is used in the enumerate function to start the index at 1. This way, the loop iterates over the elements in the list, and the index variable starts from 1 instead of 0. # Start loop indexing with non ...
🌐
Reddit
reddit.com › r/learnprogramming › when using for loops are we iterating through the index or the actual values?
r/learnprogramming on Reddit: When using for loops are we iterating through the index or the actual values?
March 8, 2023 -
for i in range(10,20):
    print(i)

I understand that i is going through the values 10 to 20. I know there can be an index attached but why do we have to explicitly associate an index to a value to change the value we want?

seasons = ['fall','winter','spring','summer'] # works like the enurate function
    for i in range(len(seasons)):
        if seasons[i] == 'summer':
            seasons[i] = 'New season'
        print(i , seasons[i])

Why do we have to associate the index to change the actual value? What exactly are we looping through

🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-access-index-in-for-loop-python
How to Access Index using for Loop - Python - GeeksforGeeks
July 23, 2025 - data = ["java", "python", "HTML", "PHP"] print("Indices:", [i for i in range(len(data))]) print("Elements:", [data[i] for i in range(len(data))]) ... Explanation: [i for i in range(len(data))] creates a list of indices. [data[i] for i in range(len(data))] creates a list of values by index. The zip() function can combine two lists: one with indices and one with elements, allowing simultaneous iteration. ... idx = [0, 1, 2, 3] data = ["java", "python", "HTML", "PHP"] print("Ind and ele:") for i, val in zip(idx, data): print(i, val)
🌐
GeeksforGeeks
geeksforgeeks.org › python › access-the-index-and-value-using-python-for-loop
Access the Index and Value using Python 'For' Loop - GeeksforGeeks
July 23, 2025 - Below are some of the examples by which we can access the index value in Python: ... In this method, we are using the range() function to generate indices and access values in a list by their position. ... # create a list of fruits fruits = ['apple', 'banana', 'orange'] print(&quot;Indices and Index value :&quot;) # Iterate over the indices of the list and access elements using indices for i in range(len(fruits)): print(f&quot;Index: {i}, Value: {fruits[i]}&quot;)
🌐
Sentry
sentry.io › sentry answers › python › accessing the index in a `for` loop in python
Accessing the Index in a `for` Loop in Python | Sentry
November 22, 2022 - For scenarios where we actually need the index or counter variable, we can use Python’s built-in enumerate function. The enumerate function returns an iterable. Each element of this iterable is a tuple containing the index of the item and the original item value, like so: directions = ['north', 'east', 'south', 'west'] directions_tuples = enumerate(directions) # output [(0, 'north'), (1, 'east'), (2, 'south'), (3, 'west')]
🌐
Stack Abuse
stackabuse.com › how-to-access-index-in-pythons-for-loop
How to Access Index in Python's for Loop
January 6, 2021 - Meaning that 1 from the # first list will be paired with 'A', 2 will be paired # with 'B' and so on... for elem1,elem2 in zip(list_a,list_b): print((elem1,elem2)) ... The length of the iterator that this function returns is equal to the length of the smallest of its parameters. Now that we've explained how this function works, let's use it to solve our task: my_list = [3, 5, 4, 2, 2, 5, 5] print ("Indices and values in my_list:") for index, value in zip(range(len(my_list)), my_list): print((index, value))
🌐
Real Python
realpython.com › python-enumerate
Python enumerate(): Simplify Loops That Need Counters – Real Python
June 23, 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 positions.
🌐
Vultr Docs
docs.vultr.com › python › built-in › enumerate
Python enumerate() - Iterate With Index | Vultr Docs
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}") Explain Code