class Person:
def __init__(self,city):
self.city = city
def location(self):
return f'Место проживания - {self.city}'
class Teacher(Person):
def __init__(self,city,name,subject_at_school):
super().__init__(city)
self.name = name
self.subject_at_school = subject_at_school
def action(self):
return f'{self.name} преподает предмет {self.subject_at_school}'
class Director(Teacher):
def __init__(self,city,name,subject_at_school,age):
super().__init__(city,name,subject_at_school)
self.age = age
def job_title(self):
return f'{self.name} - директор школы и учитель предмета {self.subject_at_school}. Ему {self.age} лет. Он живет в городе {self.city}'
t = Teacher('Москва','Иван Иванович', 'математика')
d = Director('Москва','Николай Григорьевич', 'физика',50)
print(t.location())
print(d.action())
print(d.job_title())
print(d.location())