These are the notes from how we would like this to look like
mc1 = MultipleChoiceExercise(
description='How many sides does a square have?',
key='square_sides',
options={
'one': 'One side',
'two': 'Two sides',
'three': 'Three sides',
'four': 'Four sides'
}
# OK, and then key and what you display is the same, you internally
# do `options = {k: k for k in options}`
options=['one', 'two', 'three', 'four'],
allow_multiple=False, # Default False
randomize_order=False # Default False
)
### BEGIN HIDDEN TEST
assert mc1.answer == 'four'
### END HIDDEN TEST
mc1 = MultipleChoiceExercise(
description='How many sides do a triangle or a square have?',
key='square_sides',
options={
'one': 'One side',
'two': 'Two sides',
'three': 'Three sides',
'four': 'Four sides'
}
# OK, and then key and what you display is the same, you internally
# do `options = {k: k for k in options}`
options=['one', 'two', 'three', 'four'],
allow_multiple=True, # Default False
randomize_order=False # Default False
)
### BEGIN HIDDEN TEST
print(mc1.answer) # -> always returns a set, even if allow_multiple = False
assert mc1.check_correct_answers(['four', 'three'])
assert mc1.check_correct_answers('four', 'three')
assert mc1.check_correct_answers('four')
### END HIDDEN TEST
## Try on 3 students to see if the "time cost" for grading for the teacher does NOT scale with the number of students
The MultipleChoiceExercise would inherit from ExerciseWidget
One can look at the
TextExercise for a simple implementation example inheriting from it
https://github.com/osscar-org/scicode-widgets/blob/main/src/scwidgets/exercise/_widget_text_exercise.py to get an idea how to implement it.
These are the notes from how we would like this to look like
The
MultipleChoiceExercisewould inherit fromExerciseWidgetscicode-widgets/src/scwidgets/exercise/_widget_exercise_registry.py
Line 18 in 44495c4
One can look at the
TextExercisefor a simple implementation example inheriting from it https://github.com/osscar-org/scicode-widgets/blob/main/src/scwidgets/exercise/_widget_text_exercise.py to get an idea how to implement it.