list item and index for loop python code example
Example 1: how to iterate over a list in python with index
# Create the list
my_list = [1, 2, 3]
# Python automatically creates an index for you and increments it for you
for index in range(len(my_list)):
print(my_list[index])
Example 2: for in list start with index python
for item in some_list[2:]:
# do stuff
#This will start at the third element and iterate to the end.