Is Codecademy's Python real?


#1



Student Becomes The Teacher, 8. Part of the Whole

In this lesson and (if I remember correctly) in previous ones, the instructions tell me to write "for student in students:" How would Python know what student means? I was under the impression that only things like item and key work.

Although this worry was in the back of my head since I started Python here on Codecademy, I'm now more worried that the Python taught on Codecademy is using a custom library, which could understand terms like student, whereas pure Python couldn't.

If you know, please say whether that is true or not, and if not how is it possible for terms like student to be understood?

Thanks!


Replace this line with your code.


#2

The interpreter will know perfectly well what it is because of the context.

for item in object_context:

item is defined by that opening line. It is the iterator variable and object_context is the iterable.

The name we use is arbitrary, but it is customary to use generic variables that pretty much describe what they are.

for item in a_list:

for key in a_dict:

But if our list is named fruits, we could singularize the iterator so the relationship is clear to the reader.

for fruit in fruits:

#3

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