Menu

Question

Nicolas Hainaux

The organization of the classes is analog to the one of sheets and exercises, the big difference being that the methods to write questions' texts and answers have to be rewritten for each new Question.

Q_Structure contains the to_str() method which writes the texts and answers of the Question to the output. It uses text_to_str() and answer_to_str() that are not defined here.

The instanciable Questions should all be a copy of Q_Model. They need to reimplement __init__() (which first calls Q_Structure.__init__() to set properly some fields) mainly to define the objects that will be used and what will be done; and they also must implement text_to_str() and answer_to_str().

Finally, each Question has also one global variable which should be defined. More details about it: (this should be checked again...)

  • AVAILABLE_Q_KIND_VALUES will define which kinds (and subkinds) of Questions are handled by this class. Extract from the code:

    # AVAILABLE_Q_KIND_VALUES lists so : {'q_kind1' : ['q_subkind1',
    #                                                  'q_subkind2',
    #                                                   etc.],
    #                                     'q_kind2' : ...}
    #                                    }
    

See __init__() in Q_Model.py to have some hints on where to write something.

Q_Structure in the doc
Q_Model in the doc


Related

Doc for dev: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.