Loops For Objects

You will learn how to loop over the different types of objects available in Python in this lesson.

Looping over lists

If you want to do something with every element of a list, you can use a for loop. A simple for loop looks like this:

for e in my_list:
 print(e)

If you need to work with not only the elements in the list, but also their position in the list, you can use a more complicated version of the for loop:

for i in
...