How does Python knows what is letter in string looping?


Replace this line with your code.


could you clarify the question with some code


Sorry so below is simple example,and I am interested how Python recognize that, is it already bulit order,or python recognize strings same as lists in loops so it does not matter if I write instead of letter x,y or z it will still print every letter as with lists.

for letter in "Codecademy":
print letter


Strings and lists are slightly different, you can't manipulate strings.

you can name this variable anything you like, python will assign the values to this variable. If you want in-depth understanding of how loops work, and strings work under the hood, i would learn a much lower level language (like C), to understand this you need to understand special characters (\0), points and memory management


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.