write a source assignment

Writing an assignment is done by writing a Jupyter notebook and using tags:

Write a question

Use markdown cells in Jupyter to write your question.

Write an answer

In a code cell write the code snippet that is the answer to the question:


The ### BEGIN SOLUTION and ### END SOLUTION delimiters are necessary. It is possible to pass your own set of delimiters to nbchkr (see further documentation for that).

Add the answer:<uique_label> tag to the cell.

Write a check

In a code cell write assert statements to check specific elements of the answer:

assert <condition>, <error message>

If the <condition> is not meet the <error message> will be written to the feedback on a submission.

Note that it is possible to refer to the output of a previous cell using _.

Add the score:<integer> tag to the cell. The <integer> is the value associated with this specific check. If the <condition> is met then the <integer> value will be added to the total score of a student.

Optionally, you can also add the description:<string> tag to the cell. This will add the <string> to the feedback for that specific check. Note that spaces should be replaced with - which will automatically be replaced in the feedback. For example: description:correct-answer will appear as ### Correct answer in the feedback.

Note that it is possible to write multiple checks for a given answer. This can be done so as to programmatically offer varying levels of feedback for specific parts of the task.