Python 101 : Different ways of looping over lists


The "for" loop is used to iterate over the elements an "iterable" python object, for example - string,  list, tuple -.

We have below two different ways o going through a list.

Below is one way of going over a list - L = [25, 'str', 22] - :


The other way would be:

Comments

Leave as a comment:

Archive