traverse list python code example
Example 1: list loop python
list = [1, 3, 5, 7, 9]
# with index
for index, item in enumerate(list):
print (item, " at index ", index)
# without index
for item in list:
print(item)
Example 2: iterate through a list
my_list = ["Hello", "World"]
for i in my_list:
print(i)