For Loopยถ

Something is an iterable if you can iterate over it using a โ€œfor loopโ€. Strings and lists are both iterables.

Letโ€™s make a for loop:

>>> fruits = ["strawberries", "bananas", "apples", "oranges"]
>>>
>>> for fruit in fruits:
...     print(fruit)
...
strawberries
bananas
apples
oranges

Here, fruit is a variable name which will contain a different item in each iteration of the loop.

We can use any name we like for this variable:

>>> for x in fruits:
...     print(x)
...
strawberries
bananas
apples
oranges