I wrote number, but it could have been item, word, fruit…
Say I want to go through my fruit basket:
for fruit in fruit_basket
// do something awesome
We’re going through the fruit basket, picking every fruit one by one.
Python knows what you’re referring to because you’re telling the program that you’re looking…
… for fruit within fruit_basket
As for what list it refers to, well because you’re saying it:
This precise example says “Okay, go through the fruit basket, list every fruit that’s in there, and place them somewhere else” (
.append to another place, could be another fruit basket).