pySELL
is a formal language designed to define quizzes for students. It enables rapid creation of interactive STEM quizzes, with a focus on randomized math questions. These quizzes predominantly feature numerical tasks where students input their answers into text fields.
This document describes the pySELL
language for Large Language Models (LLMs) to facilitate the automatic generation of quizzes.
Note: Not all features are described in this document yet.
A pySELL
file is an ASCII-based text file containing one or more questions.
The file begins with three lines of metadata, each defining one attribute:
LANG
: Defines the language, defaulting toen
for English.TITLE
: Defines the title of the quiz.AUTHOR
: Defines the author of the questions.
Example:
LANG en
TITLE The Art of Quizzes
AUTHOR Knuth
The questions are listed following the metadata. Each part is separated by one or more empty lines.
Questions are separated by at least one empty line.
A question consists of multiple text lines.
The first line of a question is called the question header. It starts with the keyword QUESTION
, followed by a single space, and then the title of the question.
The subsequent lines form the body of the question, containing the question code and the question text.
The question code generates random variables used to create a set of distinct question instances. The question text refers to these variables, either in the displayed text or as the solution entered by the student.
The question text is written in plain text and can include mathematical equations expressed using TeX. The variables generated by the question code are used within the text.
The question code starts and ends with """
on separate lines.
The code itself follows, written in pure Python. It should be concise and understandable.
Variable names must NOT use underscores (_
). Use camelCase instead.
Only the random
and math
libraries should be used for simple questions. If the result may contain real numbers, use the sympy
library.
Example:
"""
import random
x = random.randint(10, 20)
y = random.randint(10, 20)
z = x + y
"""
The question text is primarily plain text. To keep lines short, use line breaks. Insert \\
at the end of the line to create a line break.
Mathematical equations can be embedded using TeX. Enclose equations with dollar signs ($
). For example: The equation is $x^2 + y^2 = z^2$. Some more text follows.
. Note that dollar signs are not allowed within the equations themselves.
Identifiers within equations refer to variables from the question code if a variable with the same name exists. Otherwise, the name is displayed. Input fields for student answers are created by preceding a variable name with %
. These input fields must be outside of mathematical equations.
Input types must be one of the following: integer values, fractions, vectors, matrices, or terms. Real-valued solutions are not expected to be solved by students.
Itemizations can be created by starting a line with -
to begin a new item.
Instead of input fields for numerical inputs, you can also create single-choice and multiple-choice questions. It is also possible to combine different types of questions within a single question.
For single-choice sections, one option is correct while the other options are incorrect. Each option is placed on a separate line. The correct answer is formatted as follows: it starts with (x)
followed by the option text. Incorrect answers are formatted as follows: they start with ( )
followed by the option text.
For multiple-choice sections, one or more options are correct while the other options are incorrect. Each option is placed on a separate line. The correct answer is formatted as follows: it starts with [x]
followed by the option text. Incorrect answers are formatted as follows: they start with [ ]
followed by the option text.
An example of a multiple-choice question is as follows:
QUESTION Multiple-Choice
Mark the correct answer(s)
[x] This answer is correct
[x] This answer is correct
[ ] This answer is incorrect
A typical mathematical question might ask the student to calculate the sum of two randomly chosen integers. The question text displays these numbers and prompts the student to calculate their sum.
Example:
QUESTION Addition
"""
import random
x = random.randint(10, 20)
y = random.randint(10, 20)
z = x + y
"""
Calculate $x + y = $ %z
LANG en
TITLE The Art of Quizzes
AUTHOR Knuth
QUESTION Addition
"""
import random
x = random.randint(10, 20)
y = random.randint(10, 20)
z = x + y
"""
Calculate $x + y = $ %z
QUESTION Subtraction
"""
import random
x = random.randint(10, 20)
y = random.randint(10, 20)
z = x - y
"""
Calculate $x - y = $ %z
QUESTION Differentiation
"""
from sympy import *
x = symbols('x')
f = 3 * cos(x)
d = diff(f,x)
"""
$"f"(x)=f$ \\
$"f"'(x)=$ %d