Question Model

Question model is nothing but a Python class with three attributes - question_textcorrect_answer and choicesquestion_text is the question, correct_answer is the correct answer for that question and choices is a list of options for that question.

Let's create a question_model.py file and create the class in it:

class Question:
    def __init__(self, question: str, correct_answer: str, choices: list):
        self.question_text = question
        self.correct_answer = correct_answer
        self.choices = choices
Discussion

3

0