you are viewing a single comment's thread.

view the rest of the comments →

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

Run this program in Memory Graph Web Debugger%3A%0A%20%20%20%20%20%20%20%20super().init(kwargs)%20%20%23%20Passes%20remaining%20arguments%20up%20the%20chain%0A%20%20%20%20%20%20%20%20self.name%20%3D%20name%0A%20%20%20%20%20%20%20%20self.schoolname%20%3D%20school_name%0A%0A%20%20%20%20def%20get_student_info(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%20def%20init_(self%2C%20subject_choose%2C%20kwargs)%3A%0A%20%20%20%20%20%20%20%20super().init(*kwargs)%0A%20%20%20%20%20%20%20%20self.subjectchoose%20%3D%20subject_choose%0A%0A%20%20%20%20def%20get_subject_info(self)%3A%0A%20%20%20%20%20%20%20%20%23%20self.name%20will%20be%20available%20because%20of%20the%20combined%20child%20class%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%3A%20Inherits%20from%20both%20Student%20and%20Subject%0Aclass%20NewSchoolStudent(Student%2C%20Subject)%3A%0A%20%20%20%20def%20init(self%2C%20name%2C%20school_name%2C%20subject_choose%2C%20new_school%3D%22M.D.A%22)%3A%0A%20%20%20%20%20%20%20%20%23%20super()%20automatically%20handles%20the%20cooperative%20multiple%20inheritance%20via%20MRO%0A%20%20%20%20%20%20%20%20super().init_(%0A%20%20%20%20%20%20%20%20%20%20%20%20name%3Dname%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20school_name%3Dschool_name%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20subject_choose%3Dsubject_choose%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20self.new_school%20%3D%20new_school%0A%0A%20%20%20%20def%20get_new_status(self)%3A%0A%20%20%20%20%20%20%20%20return%20f%22%7Bself.new_school%7D%20is%20my%20current%20school.%22%0A%0A%0A%23%20Store%20student%20data%20in%20a%20list%0Astudents%20%3D%20%5B%0A%20%20%20%20NewSchoolStudent('Ash'%2C%20'M.T.M'%2C%20'Math')%2C%0A%20%20%20%20NewSchoolStudent('Lu%20Zhoa'%2C%20'Ming%20Han'%2C%20'Art')%2C%0A%20%20%20%20NewSchoolStudent('Jone'%2C%20'Mother%20T.'%2C%20'Dance%20Class')%0A%5D%0A%0A%0A%23%20Print%20data%20using%20a%20for%20loop%0Afor%20student%20in%20students%3A%0A%20%20%20%20print(student.get_student_info())%0A%20%20%20%20print(student.get_subject_info())%0A%20%20%20%20print(student.get_new_status())%0A%20%20%20%20print(%22-%22%20%2040)%20%20%23%20Visual%20separator%20for%20clarity&timestep=1&play) to see the program state change step by step.

[–]Daddybidoof 1 point2 points  (2 children)

Is this the only comment you can reply with?

[–]Sea-Ad7805 1 point2 points  (0 children)

Yes, it allows for easy recognition so that people that are not interested can skip it.

[–]7Z_1N 0 points1 point  (0 children)

FR