Python List For Loop

To iterate over elements of a Python List using For Loop statement, use the list as iterable in For loop syntax.

In this tutorial, we will go through example Python programs, that demonstrate how to iterate a list using Python For Loop.

The syntax to iterate over Python List using For Loop, and print that element is given below.

for element in mylist :
    print(element)

where mylist is the Python List, and element is the element with read only access during each iteration. Meaning, you cannot change the value of elements in the list, using for loop.

Example 1 – Iterate Python List using For Loop

In this example, we will take a Python List, and iterate over all the elements of this list using for loop.

Python Program

list_1 = [4, 52, 6, 9, 21]

for element in list_1 :
    print(element)
Try Online

Output

4
52
6
9
21

Example 2 – Iterate Python List of Strings using For Loop

In this example, we will take a Python List of strings, and iterate over all the elements of list using for loop.

Python Program

list_1 = ["Nemo", "Arc", "Gary"]

for element in list_1 :
    print(element)
Try Online

Output

Nemo
Arc
Gary

Conclusion

In this Python Tutorial, we learned how to iterate over elements of a Python List using For Loop statement.