Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SchoolMember:
- def __init__(self, name, age):
- self.name = name
- self.age = age
- class Teacher(SchoolMember):
- def __init__(self, name, age, salary):
- super().__init__(name, age)
- self.salary = salary
- self.courses = []
- def add_course(self, course):
- self.courses.append(course)
- def remove_course(self, course):
- self.courses.remove(course)
- class Student(SchoolMember):
- def __init__(self, name, age):
- super().__init__(name, age)
- self.courses = []
- def add_course(self, course):
- self.courses.append(course)
- def remove_course(self, course):
- self.courses.remove(course)
- a = Student('Georgi', 16)
- a.add_course('Math')
- print(a.courses) # ['Math']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement