Before we begin - iterating through list


#1

names = ["Adam","Alex","Mariah","Martine","Columbus"]
for list in names:
    print list

what is iterating trough list used in excatly
and i can do words instead of list what is the difference


#2

A list, a string, a tuple, a dictionary... These are all iterables which means they can be counted and gone through, one by one. That's what iteration is. Going through a list.

    for i in names:
        print i

We are iterating through the names list, one element at a time.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.