confusing isn't it? Python is here doing a lot of work for you.
what python is doing under the hood, is determine the length of the string (or lists, works roughly the same) and loop over them. Lets look at the general syntax:
for iterator in string:
the iterator gets assigned each item in the list in sequence, in essence you are defining a variable which gets updated by the loop (it gets assigned the next letter until the string is over)
Python does a lot for you, this can be nice (you have to write less code) and confusing (why does this code work this)