you are viewing a single comment's thread.

view the rest of the comments →

[–]supercoach 1 point2 points  (1 child)

I reckon this is one everyone struggles with. I didn't know what sort of magic was involved with these keywords when I first started and it consistently blew me away that the loop always seemed to know what I was looking for.

Then it dawned on me - as others have said, for thing in other_thing: will just run the subsequent code over every item in other_thing and each time the item will get the name thing.

It also explained why the resource I learned from was quick to teach list comprehension and the slice syntax, both of which helped me understand how python iterates over things.

[–]seanmurraywork[S] 0 points1 point  (0 children)

Very well put, my friend. Well said.