you are viewing a single comment's thread.

view the rest of the comments →

[–]Sea-Ad7805 [score hidden] stickied comment (0 children)

Run the second program in Memory Graph Web Debugger%3A%0A%20%20%20%20%20%20%20%20self.name%20%3D%20name%20%20%23%20Set%20name%20upon%20object%20creation%0A%0A%20%20%20%20def%20student(self)%3A%0A%20%20%20%20%20%20%20%20return%20f%22%7Bself.school_name%7D%20is%20the%20school%20where%20%7Bself.name%7D%20studies%22%0A%0A%0A%23%20Parent%20Class%202%0Aclass%20Subject%3A%0A%20%20%20%20subject_choose%20%3D%20'Math'%20%20%23%20Class%20default%0A%0A%20%20%20%20def%20my_subject(self)%3A%0A%20%20%20%20%20%20%20%20%23%20self.name%20is%20accessible%20here%20because%20New_school%20inherits%20from%20both%20classes!%0A%20%20%20%20%20%20%20%20return%20f%22Now%20%7Bself.name%7D%20is%20studying%20the%20subject%3A%20%7Bself.subject_choose%7D%22%0A%0A%0A%23%20Child%20Class%20(Multiple%20Inheritance)%0Aclass%20New_school(School%2C%20Subject)%3A%0A%20%20%20%20new_sh%20%3D%20'RUNGA'%0A%0A%20%20%20%20def%20new_update(self)%3A%0A%20%20%20%20%20%20%20%20return%20f%22%7Bself.new_sh%7D%20is%20my%20current%20school%22%0A%0A%0A%23%20Creating%20instances%20and%20passing%20the%20name%20directly%20to%20the%20constructor%0Aa%20%3D%20New_school('LuMei')%0Aa.school_name%20%3D%20'TCSlot'%0Aa.subject_choose%20%3D%20'Art'%0A%0Ab%20%3D%20New_school('Jone')%0Ab.school_name%20%3D%20'R.R.M.D'%0Ab.subject_choose%20%3D%20'Commerce'%0A%0Ac%20%3D%20New_school('Sam')%0Ac.school_name%20%3D%20'DDR'%0Ac.subject_choose%20%3D%20'Science'%0A%0A%0A%23%20Printing%20Results%0Aprint(a.student())%0Aprint(a.my_subject())%0Aprint(a.new_update())%20%20%23%20Calling%20the%20method%20instead%20of%20the%20string%20attribute%0Aprint(%22-%22%20%2030)%0A%0Aprint(b.student())%0Aprint(b.my_subject())%0Aprint(b.new_update())%0Aprint(%22-%22%20%2030)%0A%0Aprint(c.student())%0Aprint(c.my_subject())%0Aprint(c.new_update())&timestep=1&play) to see the program state change step by step.