Hi, @orouge ,
This is an interesting case.
Version 2 is correct, and that is why it passes when you submit it.
Version 1 is incorrect. If you refresh the page and then submit version 1, you will get an error, because it incorporates these two statements into the definition of the
Animal class ...
hippo = Animal("John", 5)
The first of those two statements will attempt to instantiate an
Animal before the definition of the
Animal class has been completed, and this message will appear in the console window ...
Traceback (most recent call last):
File "python", line 1, in <module>
File "python", line 10, in Animal
NameError: name 'Animal' is not defined
However, if you submit version 1 without first refreshing the page, right after you have submitted version 2, version 1 will pass, because Codecademy will still have the completed
Animal class definition from version 2 in memory when it encounters the instantiation statement.