3.1š Installation¶
All packages can be installed at once (labquiz, quiz_editor and quiz_dash)
# From PyPI
pip install labquizbundleor individually, e.g.
pip install labquizThey can also be installed from source e.g.
# From source
pip install git+https://github.com/jfbercher/labquiz.git#subdirectory=quiz_editorwith subdirectories meta (the bundle) , quiz_nb (for labquiz), quiz_editor and quiz_dash.
Use pip in a terminal, or %pip ... in a notebook cell.
For quiz_editor and quiz_dash, entry points are provided, allowing to use the apps directly from the command line by simply invoking
quiz_dash
# or
quiz_editor [FILENAME.yaml]It is possible to use a standalone version, without any Python installation, which runs in the browser. This is described in SectionĀ 11.1.
3.2Usage¶
Once labquiz is installed, import it with
import labquiz
from labquiz import QuizLaband instantiate a quiz with
URL = "" # path to a URL to collect results
QUIZFILE = "name_of_quiz_file.yaml" # for example "quizzes_basic_filtering_test.yaml"
quiz = QuizLab(URL, QUIZFILE)Additional parameters can be specified (default values below)
needAuthentication=True, # Authentication required yes/no
retries=2, # number of possible attempts = retries + 1
exam_mode=False, # default False
test_mode=False, # default False
groups=[], # list of groups (or classes) of students, eg ['A', 'B', 'C'] - used to present a dropdown of choices
mandatoryInternet=False, # requirement to have a valid internet connection (in particular for exams with encrypted YAML file with remote password)
CHECKALIVE=60, # integrity check every CHECKALIVE seconds
INACTIVITY_TIMEOUT=3600, # suspend the integrity daemon if no activity recorded during this time
in_streamlit=False, # put it to True is quiz is instancied in streamlit app
#(no changes to the program or parameters)
FigureĀ 6:Login example
3.3Features¶
ā ļø LabQuiz also works in visual studio code, but portions are not rendered in questions, suggestions, and answers. This is a limitation of Visual Studio, which does not load MathJax, and may be improved in the future. In the meantime, it is better to use a classic Jupyter, Colab, or JupyterLite. In Visual Studio, this can be managed, but it is less effective if there is in the text.
3.3.1Types of quiz questions¶
Four types of questions are available:
multiple-choice questions (
type: "qcm"in the question file; this is the default type)numerical questions (
type: "numeric")Context-dependent multiple-choice questions (
type: "qcm-template")Context-dependent numerical questions (
type: "numeric-template") The structure of the question file, where these different types are indicated, is presented SectionĀ 4.1. How to prepare and even encrypt this file is presented in .
Templates allow you to ask questions that depend on local variables. This allows you to test specific values, orders of magnitude, the result of a calculation, or the consistency between several values. Here are two examples to illustrate this:

FigureĀ 7:Template questions that use numerical values passed as parameters
3.3.2Different presentation modes¶
3.3.2.1Learning mode¶
In learning mode, all four buttons are available. The validate button displays the score obtained, see FigureĀ 8. The tips button displays advice. The correct button displays the correction, see FigureĀ 9 and FigureĀ 10. The boxes turn green if they have been checked or unchecked correctly, and red if not. The checks entered by the user are retained, but colored green or red depending on the correct result. After the correction has been requested, the validate, reset, and tips buttons are disabled and become inoperative.

FigureĀ 8:Learning mode - the submit button has been pressed

FigureĀ 9:Learning mode - the corrected button has been pressed

FigureĀ 10:Learning mode - the correct button has been pressed and the correction is displayed
3.3.2.2Test mode¶
In test mode, the correct button is removed. The student sees their score after validation and tips are possible. The number of validations is limited by the retries parameter passed at initialization.

FigureĀ 11:Test mode - the validate button has been pressed
3.3.2.3Exam mode¶
In exam mode, there is no score display, no tips, and no corrections. Only the reset and validate buttons appear.

FigureĀ 12:Exam mode - the submit button has been pressed
3.3.2.4Individual questions or series of questions exam_show¶
Regardless of the presentation modes described above, questions can be presented either individually with a call of the form quiz.show(ālabelā), or in a block of questions. The latter option can be useful for a short interim review, for example.
A block of questions will be presented using the quiz.exam_show() function with the following parameters:
exam_show(exam_title="", questions=None, shuffle=False, nb=None)exam_title: Used to identify the exam, default āā
questions: List of question labels (e.g. āquiz1,ā āquiz2ā). If None, uses all questions in the bank.
shuffle: default False; If True, shuffles the order of questions before display.
nb: If not None, randomly draws nb distinct questions from the set of available questions.
An example of a call could be
ql = quiz.exam_show(exam_title="Test to see", shuffle=True, nb=4)Intermediate results are not displayed (if in learning or test mode).
The results obtained can then be viewed by the student with quiz.exam_result(ql, marking_scheme=None).
In exam mode, results are not calculated or viewable, and the teacher can correct all exams as described in .