In Python, looks (just as in any other language) are a way to execute a specific block of code several times. In particular, loops are used to iterate or loop over what we call iterables.
For the purposes of this chapter, we can define an iterable as follows:
Anything that can be looped over (that is, you can loop over a string or a file)
Anything that can appear on the right-hand side of a for loop, for example, for x in iterable
A few examples of common iterables include the following:
Strings
Lists
Dictionaries
Files
You can think of an iterable as a collection of homogeneous things that have been grouped together to form a large collective. The individuals in the group have the same properties, and when they are combined, they form something new.
Consider the example of cars in a car yard. We can consider the car yard as the collection or iterable and the individual cars as the constituent members of the car yard. If you were shopping for a car, you would probably have a couple of qualities...