Examples from element documentation

Examples below are taken from the documentation page for PrairieLearn Elements in question.html .


Submission Elements


pl-multiple-choice
Example of a multiple choice element.

Correct Input: negative

pl-checkbox
Example of a multiple selection element.

Correct Input: A-B, B-C, and D-E.

Checkbox options
Select all possible options that apply.
pl-number-input
Example of a fill in the blank element that accepts numeric values.

Correct Input: 1.4317184979665578

$x =$

Correct Input: 1.43

$x =$
pl-integer-input
Example of a fill in the blank element that accepts integer values.

Correct Input: 42

$y =$
pl-symbolic-input
Example of a fill in the blank element that accepts mathematical expression values.

Correct Input: x + y + 1

$z =$
pl-string-input
Example of a fill in the blank element that accepts string values.

Correct Input: Learn

Prairie
pl-matrix-component-input
Example of a fill in the blank element that provides input fields for each entry of a matrix.

Correct Input:

  • 1 in location 1x1
  • 2 in location 1x2
  • 3 in location 2x1
  • 4 in location 2x2
pl-matrix-input
Example of a fill in the blank element that provides an input field for supplying the underlying code required to create the matrix.

Correct Input:

  • MATLAB: [1 2; 3 4]
  • Python: [[1, 2], [3, 4]]
pl-file-editor
Example of an inbrowser code file editor submission element.
fib.py
pl-file-upload
Example of a file submission element.

Correct Input: foo.py, bar.c, and filename with, comma.txt

Files

Decorative Elements


pl-code

Example of embedding code blocks with syntax highlighting.

1
2
def square(x):
    return x * x
pl-figure

Example of displaying an image in a question.

pl-file-download

Example of providing a file download option.

data.txt
pl-variable-output

Example of displaying matrices using a code export.

1
2
C = [5.000 6.000; 7.000 8.000];
D = [-1.000 4.000; 3.000 2.000];
1
2
Cm = {{5, 6}, {7, 8}};
Dm = {{-1,  4}, { 3,  2}};
1
2
3
4
import numpy as np

C = np.array([[5, 6], [7, 8]])
D = np.array([[-1,  4], [ 3,  2]])
1
2
C = matrix(c(5, 6, 7, 8), nrow = 2, ncol = 2, byrow = TRUE)
D = matrix(c(-1,  4,  3,  2), nrow = 2, ncol = 2, byrow = TRUE)
1
2
3
4
from sympy import *

C = Matrix([[5, 6], [7, 8]])
D = Matrix([[-1,  4], [ 3,  2]])
pl-matrix-latex

Example of displaying a matrix using latex.

$C = \begin{bmatrix} 5 & 6\\ 7 & 8\\\end{bmatrix}$
pl-graph

Example of a graphviz visualization.

G A A B B A->B

Example of a graphviz visualization.

A A A->A 0.31 B B A->B 0.06 C C A->C 0.63 B->A 0.46 B->B 0.07 B->C 0.47 C->A 0.08 C->B 0.89 C->C 0.03
pl-python-variable

Displaying contents of a Python dictionary.

1
{'a': 1, 'b': 2, 'c': 3}
pl-dataframe

Displaying contents of a Pandas DataFrame from Python.

  col1 col2
0 1 3
1 2 4

2 rows x 2 columns

pl-overlay

What is the length of the hypotenuse?

$$3$$
$$3$$

Correct answer

Student view placeholder

In student views this area is used for assessment and score info.
Tools

Staff information

Question

Title:
Examples from element documentation

Variant

Started at:
2026-08-04 20:43:20 (CDT)
Duration:
0s
Show/Hide answer
{
  "c": 4.242640687119285,
  "acc": {
    "key": "a",
    "html": "negative",
    "score": 1,
    "feedback": null
  },
  "vpos": [
    {
      "key": "d",
      "html": "A-B",
      "feedback": null
    },
    {
      "key": "e",
      "html": "B-C",
      "feedback": null
    },
    {
      "key": "f",
      "html": "D-E",
      "feedback": null
    }
  ],
  "ans_sig": 1.43,
  "matrixA": {
    "_type": "ndarray",
    "_dtype": "int64",
    "_value": [
      [
        1,
        2
      ],
      [
        3,
        4
      ]
    ]
  },
  "matrixB": {
    "_type": "ndarray",
    "_dtype": "int64",
    "_value": [
      [
        1,
        2
      ],
      [
        3,
        4
      ]
    ]
  },
  "ans_rtol": 1.4317184979665578,
  "int_value": 42,
  "string_value": "Learn",
  "symbolic_math": {
    "_type": "sympy",
    "_value": "x + y + 1",
    "_variables": [
      "x",
      "y"
    ],
    "_assumptions": {
      "x": {
        "commutative": true
      },
      "y": {
        "commutative": true
      }
    },
    "_custom_functions": []
  }
}
History
dec frac
rad deg