12311k

Untitled

Feb 4th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. class Human:
  2. def __init__(self, name):
  3. self.name = name
  4.  
  5. def answer_question(self, question):
  6. print("Очень интересный вопрос! Не знаю.")
  7.  
  8.  
  9. class Student(Human):
  10. def ask_question(self, someone, question):
  11. print(f'{someone.name}, {question}')
  12. someone.answer_question(question)
  13. print()
  14.  
  15.  
  16. class Curator(Human):
  17. def answer_question(self, question):
  18. if question == "мне грустненько, что делать?":
  19. print("Держись, всё получится. Хочешь видео с котиками?")
  20. else:
  21. super().answer_question(question)
  22.  
  23.  
  24. class CodeReviewer(Human):
  25. def answer_question(self, question):
  26. if question == "что не так с моим проектом?":
  27. print("О, вопрос про проект, это я люблю.")
  28. else:
  29. super().answer_question(question)
  30.  
  31.  
  32. class Mentor(Human):
  33. def answer_question(self, question):
  34. if question == "мне грустненько, что делать?":
  35. print("Отдохни и возвращайся с вопросами по теории.")
  36. elif question == "как устроиться работать питонистом?":
  37. print("Сейчас расскажу.")
  38. else:
  39. super().answer_question(question)
  40.  
  41.  
  42. student1 = Student('Тимофей')
  43. curator = Curator('Марина')
  44. mentor = Mentor('Ира')
  45. reviewer = CodeReviewer('Евгений')
  46. friend = Human('Виталя')
  47.  
  48. student1.ask_question(curator, 'мне грустненько, что делать?')
  49. student1.ask_question(mentor, 'мне грустненько, что делать?')
  50. student1.ask_question(reviewer, 'когда каникулы?')
  51. student1.ask_question(reviewer, 'что не так с моим проектом?')
  52. student1.ask_question(friend, 'как устроиться на работу питонистом?')
  53. student1.ask_question(mentor, 'как устроиться работать питонистом?')
Add Comment
Please, Sign In to add comment