def fill_quiz(quiz) -> QuizAnswer: quiz_answer = QuizAnswer(quiz) question_handler = QuestionInputHandler() print("Quiz:" + quiz.title) for question in quiz.questions: answers = question_handler.ask_question_value(question) answer = Answer(answers, question) quiz_answer.add_answer(answer) return quiz_answer
def fill_quiz(quiz) -> QuizAnswer: quiz_answer = QuizAnswer(quiz) question_handler = QuestionInputHandler() print("Quiz:" + quiz.title) for question in quiz.questions: answers = question_handler.ask_question_value(question) answer = Answer(question, answers) quiz_answer.add_answer(answer) return quiz_answer myclass = MyClass(quiz_answer) json = MyEncoder().encode(myclass) f = open("myform.json", "w") f.write(json) f.close()