+ 2

Where is the problem with the code?

class Person: def __init__(self, name, age): self.name=name self.age=age def introduce_self(self): print(f"Hi {self.name} {self.age}") class UniversityMember(Person): def __init__(self, name , age, university_name): super().__init__(name, age) self.university_name= university_name def introduce_self(self): print(f"Hi {self.university_name}") class Student(UniversityMember): def __init__(self, name , age, university_name, student_id): super().__init__(name, age, university_name) self.student_id = student_id def introduce_self(self): super().introduce_self() print(self.student_id) class Instructor(UniversityMember): def __init__(self, name , age, university_name, employee_id): super().__init__(name, age, university_name) self.employee_id = employee_id def introduce_self(self): super().introduce_self() print(self.employee_id) Instructor1= Instructor("hesam", 23, "AZAD", 234) Instructor1.introduce_self() Student1= Student ("hesam", 23, "AZAD", 53) Student1.introduce_self() class MemberUniversity(Instructor, Student): def __init__(self, name, age, university_name, employee_id, student_id=2): Person.__init__(name, age) self.university_name=university_name self.employee_id = employee_id self.student_id= student_id print("hello I am") def introduce_self(self): super().introduce_self() print("Hey") MemerU = MemberUniversity("hesam", 23, "AZAD",1223,23)

10th Sep 2024, 7:24 AM
He3amtesla
He3amtesla - avatar
2 Answers
+ 4
He3amtesla , this line is missing `self` : Person.__init__(name, age)
10th Sep 2024, 10:15 AM
Lothar
Lothar - avatar
+ 3
https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app Follow this tutorial or it will be hard for people to help you Also specify the type of error (logic, syntax, etc)
10th Sep 2024, 8:31 AM
Ugulberto SĂĄnchez
Ugulberto SĂĄnchez - avatar