Member variable, class it up


why is that so? why it has to be at the last line of init function and same indentattion levle as sef?

About member variable in Triangle class Class It Up

It has to be inside the Triangle Class and after initialization.


or before initialization

@dragonmaidenz, member variable (more commonly known as class variable) are declared outside the init method. (python uses indention to determines what is nested in class and init method)

the __init__() is a method which get called automatically when you initialize a class instance, given member variables have the same value for all instances, there is no reason to make this instance specific (placing it inside init)


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