Skip to content

Code Editor

Configure starter files, a run command, and rubric criteria that compare program output.

What this block does

The Code Editor gives students a file workspace inside the lesson. Configure the exercise’s environment, starter files, and run command, then add grading criteria for the behavior you want to check.

Build the workspace

  1. Insert Code Editor and write the task.
  2. Add your starter files with the correct file paths.
  3. Mark files read-only when students should inspect them without changing them. Mark files hidden when they should not appear in the student workspace.
  4. Choose the execution environment and set the run command for the project.
  5. Decide whether to allow pasting in the editor.

Add an output test

A code grading criterion has its own points, environment, run command, standard input, and expected output. Comparison can be exact, regex, or partial. Case and whitespace handling are configurable; Show diff controls the output comparison display.

For a Python program that doubles a number read from standard input, a criterion could use:

Run command: python main.py
Standard input: 4
Expected output: 8
Comparison: exact

Add another criterion with a different input to test another case. This is an example configuration, not a preinstalled test suite.

Check before assigning

Run the starter project and a known-correct solution. Confirm that the command uses the right file path and that your expected output matches the program’s actual output, including prompts and line breaks.

Troubleshooting

If a test fails despite a correct calculation, inspect extra printed text and whitespace. If the program waits indefinitely, check whether it expects standard input that the criterion does not provide. A hidden file is a visibility setting; it does not automatically become a grading criterion.

Block preview

Edit, run, and grade code in a course. This preview shows the actual block with course actions disabled.

Loading the lesson block…
Create a course to try it →
Explore this teaching tool