class Human:
def
init(self, name):
self.name = name
def
str(self):
return(
self.name)
def answer_question(self, question):
print('Очень интересный вопрос! Не знаю.')
class Student(Human):
def ask_question(self, someone, question):
print(f'{someone}, {question}')
# запросите ответ на вопрос у someone
someone.answer_question(question)
print() # этот print выводит разделительную пустую строку
class Curator(Human):
def answer_question(self, question):
if question == 'мне грустненько, что делать?':
print(f'Держись, всё получится. Хочешь видео с котиками?')
else:
super().answer_question()
class CodeReviewer(Human):
def answer_question(self, question):
if question == 'что не так с моим проектом?':
print(f'О, вопрос про проект, это я люблю.')
else:
super().answer_question(question)
class Mentor(Human):
def answer_question(self, question):
if question == 'как устроиться работать питонистом?':
print(f'Сейчас расскажу.')
elif question == 'мне грустненько, что делать?':
print(f'Отдохни и возвращайся с вопросами по теории.')
else:
super().answer_question(question)
# следующий код менять не нужно, он работает, мы проверяли
student1 = Student('Тимофей')
curator = Curator('Марина')
mentor = Mentor('Ира')
reviewer = CodeReviewer('Евгений')
friend = Human('Виталя')
student1.ask_question(curator, 'мне грустненько, что делать?')
student1.ask_question(mentor, 'мне грустненько, что делать?')
student1.ask_question(reviewer, 'когда каникулы?')
student1.ask_question(reviewer, 'что не так с моим проектом?')
student1.ask_question(friend, 'как устроиться на работу питонистом?')
student1.ask_question(mentor, 'как устроиться работать питонистом?