Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dict_questions = {
- 'bad_questions': [
- 'Ты пил?',
- 'Ты курил?',
- 'Ты разводился?',
- ],
- 'good_questions': [
- 'Помогал ли бездомным людям?',
- 'Переводил ли бабушку через дорогу?'
- ],
- 'moot_questions': [
- 'Ты воевал?',
- 'Ты был врачом?'
- ],
- }
- # print(dict_questions['good_questions'])
- # str - "stroke"
- # int - 121, 102
- # list - [1, 2, 3]
- # dict - {"name": "Dima"}
- # bool - True\False
- class People:
- """ Класс человека """
- def __init__(self, name, age):
- self.name = name
- self.age = age
- self.answers = {}
- def set_answer(self, question: str, answer: str):
- self.answers[question] = answer
- def get_answers(self):
- i = 1
- print('Ваши ответы на вопросы: ')
- for question, answer in self.answers.items():
- print(f'{i}. {question} {answer}')
- i += 1
- class Church:
- """ Класс церкви """
- def __init__(self, name: str, questions: dict):
- self.name = name
- self.questions = questions
- self.blocks = {
- 'good': [],
- 'bad': [],
- 'moot': []
- }
- def get_bad_people(self):
- return self.blocks['bad']
- def testing(self, people):
- """
- :param people: кто будет проходить наше тестирование
- """
- bad_answer = 0
- for type_question, questions in self.questions.items():
- for question in questions:
- answer = input(f"{question} ")
- if type_question == 'bad_questions': # Если перебираем плохие вопросы
- if answer == 'Да':
- bad_answer += 1
- people.set_answer(question, answer)
- else: # Перебираем всё остальное
- people.set_answer(question, answer)
- if bad_answer:
- self.blocks['bad'].append(people)
- print('Вы попали в порицательный блок :(')
- else:
- self.blocks['good'].append(people)
- self.blocks['moot'].append(people)
- print('Вы попали в положительный блок :)')
- church_1 = Church('Ефес', dict_questions)
- people_1 = People("Вася", 30)
- church_1.testing(people_1)
- people_1.get_answers()
- # language = {
- # 'Hello': 'Привет',
- # 'Bay': 'Пока',
- # 'Привет': 'Hello',
- # 'Пока': 'Bay',
- # 'lock': {
- # 0: 'Замок от двери',
- # 1: 'Замок как здание'
- # }
- # }
- # print(language['Привет'])
- # print(language.get('World', 'Такого ключа в словаре нет'))
- # print(language['Hello'])
- # print(language['lock'][1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement