#!/usr/bin/env python3 """Use the moocloze library to produce a single question that employs all supported fields. """ __author__ = "Miguel Hernández-Cabronero" __since__ = "2023/10/21" import moocloze import math def generate_question_all_fields(output_path="question_with_all_fields.xml"): question = moocloze.Question( name="Question testing all supported Cloze fields", contents=("This is a question testing all supported Cloze fields.
" "" "Note that all fields admit a `weight` parameter that determines its relative " "value within the question they are displayed. For instance the following " "one is 10 times as important as any of the others: " + str(moocloze.Multichoice(correct_answer='choose me', incorrect_answers=['do not choose me'], weight=10))), general_feedback="This feedback will be shown whenever the user completes the question " "(correctly or otherwise)." ) moocloze.Quiz([question]).to_xml_file(output_path=output_path) if __name__ == "__main__": generate_question_all_fields()