Advertisement
SomeBody_Aplle

Untitled

Jun 27th, 2023
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. dict_questions = {
  2. 'bad_questions': [
  3. 'Ты пил?',
  4. 'Ты курил?',
  5. 'Ты разводился?',
  6. ],
  7. 'good_questions': [
  8. 'Помогал ли бездомным людям?',
  9. 'Переводил ли бабушку через дорогу?'
  10. ],
  11. 'moot_questions': [
  12. 'Ты воевал?',
  13. 'Ты был врачом?'
  14. ],
  15. }
  16.  
  17.  
  18. # print(dict_questions['good_questions'])
  19.  
  20.  
  21. # str - "stroke"
  22. # int - 121, 102
  23. # list - [1, 2, 3]
  24. # dict - {"name": "Dima"}
  25. # bool - True\False
  26.  
  27. class People:
  28. """ Класс человека """
  29.  
  30. def __init__(self, name, age):
  31. self.name = name
  32. self.age = age
  33. self.answers = {}
  34.  
  35. def set_answer(self, question: str, answer: str):
  36. self.answers[question] = answer
  37.  
  38. def get_answers(self):
  39. i = 1
  40. print('Ваши ответы на вопросы: ')
  41. for question, answer in self.answers.items():
  42. print(f'{i}. {question} {answer}')
  43. i += 1
  44.  
  45.  
  46. class Church:
  47. """ Класс церкви """
  48.  
  49. def __init__(self, name: str, questions: dict):
  50. self.name = name
  51. self.questions = questions
  52. self.blocks = {
  53. 'good': [],
  54. 'bad': [],
  55. 'moot': []
  56. }
  57.  
  58. def get_bad_people(self):
  59. return self.blocks['bad']
  60.  
  61. def testing(self, people):
  62. """
  63. :param people: кто будет проходить наше тестирование
  64. """
  65. bad_answer = 0
  66. for type_question, questions in self.questions.items():
  67. for question in questions:
  68. answer = input(f"{question} ")
  69. if type_question == 'bad_questions': # Если перебираем плохие вопросы
  70. if answer == 'Да':
  71. bad_answer += 1
  72. people.set_answer(question, answer)
  73. else: # Перебираем всё остальное
  74. people.set_answer(question, answer)
  75. if bad_answer:
  76. self.blocks['bad'].append(people)
  77. print('Вы попали в порицательный блок :(')
  78. else:
  79. self.blocks['good'].append(people)
  80. self.blocks['moot'].append(people)
  81. print('Вы попали в положительный блок :)')
  82.  
  83.  
  84. church_1 = Church('Ефес', dict_questions)
  85. people_1 = People("Вася", 30)
  86.  
  87. church_1.testing(people_1)
  88. people_1.get_answers()
  89.  
  90.  
  91. # language = {
  92. # 'Hello': 'Привет',
  93. # 'Bay': 'Пока',
  94. # 'Привет': 'Hello',
  95. # 'Пока': 'Bay',
  96. # 'lock': {
  97. # 0: 'Замок от двери',
  98. # 1: 'Замок как здание'
  99. # }
  100. # }
  101. # print(language['Привет'])
  102. # print(language.get('World', 'Такого ключа в словаре нет'))
  103. # print(language['Hello'])
  104. # print(language['lock'][1])
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement