Back to news list

Question Writing and Element Features

Posted on 2024-07-23 by Eliot Robson

Various new features and quality of life improvements for question creation have been recently deployed. These include new elements, additional features for existing elements, and more utility code to improve the experience of question writing.


New Elements


pl-hidden-hints

The pl-hidden-hints element allows course content developers to progressively reveal hints for a given question variant as more submissions are received. In the example below, the first two hints are available to the student immediately, while the third is only shown after three valid submissions.

Screenshot showing three hints

For more information and examples, see the pl-hidden-hints documentation.


pl-big-o-input

The pl-big-o-input element allows instructors to easily write questions asking for big-O family asymptotic notation. This is especially useful for asking students about algorithmic runtime. Of note is that this element gives partial credit for technically correct but non-optimal answers.

Screenshot of question Screenshot of incorrect response Screenshot of correct response

For more information and examples, see the pl-big-o-input documentation.


pl-dataframe

The pl-dataframe element allows for displaying Pandas DataFrames using customizable display options. This functionality was previously included in the the pl-python-variable element, but that has been deprecated in favor of the new pl-dataframe element while expanding the available features. This accompanies greater support for Pandas DataFrame serialization.

Screenshot of DataFrame

For more information and examples, see the pl-dataframe documentation.


New Element Features


pl-python-variable

As mentioned above, the pl-python-variable element has had DataFrame display functionality deprecated in favor of the pl-dataframe element. However, the pl-python-variable element has received support for displaying complex objects by way of the Python pprint module. This makes it much easier to print complex dictionaries and other nested data types.

Screenshot displaying a complex dictionary

For more information and examples, see the pl-python-variable documentation.


pl-external-grader-variables

Previously, available variables for externally graded questions in Python had to be defined in a server.py file. Now, the pl-external-grader-variables element has support for defining these variables directly in the question.html file. This means that server.py files defining just these variables can be removed, thus decreasing the maintenance burden for courses.

For more information and examples, see the pl-external-grader-variables documentation.


pl-graph

The pl-graph element has expanded functionality for displaying adjacency matrices (being able to handle negative weights and undirected graphs), and now has support for displaying NetworkX graphs.

Screenshot of a rendered graph

For more information and examples, see the pl-graph documentation.


Utility Code Improvements

There have been substantial improvements to utility code available to instructors in the prairielearn.py Python library, including greater support for JSON serialization and more utility functions usable in writing questions. These changes have primarily been to facilitate writing generation and grader code for questions and to support the new elements and features discussed above. This has all been detailed in updated and expanded documentation on question writing.


If you have any questions, concerns, or suggestions, you can submit them at https://github.com/PrairieLearn/PrairieLearn/discussions. These changes were a combined effort by multiple people, including Eliot Robson and James J Balamuta from UIUC.