for works differently in Python than it works in languages like C. Instead of counting up/down a numerical value and checking an end condition as you usually would in C:
for (i=0; i<=max; i++) do_something();
it iterates over all the elements in the container (whose name is referenced after the in):
for item in iterable:
do_something(item)
Its precise behavior depends on the type of container (iterable) used; in a list or tuple, it will start at the first element, then move through the list/tuple one item at a time until the final element has been reached. Each of the elements will be then referenced by a name (item in this example) so that it can be operated on in the body of the loop.
In a dictionary, for would iterate through the dictionary's keys (in an unspecified order), so item would contain a key of the dictionary.
In a string, it iterates through the letters of the string, one by one. Etc.
lenfunction internally does the type checking for x