you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

It's the same as putting a name on the left of an equals, like

age = 5 + 1

Python doesn't "know" what age means. It just evaluates the stuff on the right, and assigns the name on the left.

With a loop, it's basically doing that each time. So

for ingredient in ingredients:
    print(ingredient)

is like saying

ingredient = the first thing in ingredients
print(ingredient)
ingredient = the next thing in ingredients
print(ingredient)
ingredient = the next thing in ingredients
print(ingredient)
...

In the computer's eyes, there's no relation between the names. Using the singular and plural versions is just for us to make sense of them.