Plantoir

Code

Programs students run on the class website, and questions they check for themselves. Each starts as an ordinary code block or callout in your notes, with a word or two added.


Each part of this page shows the text you type, exactly as you type it, beside what students get from it. The two Python examples come from the ready-made course for ICS3U, so you can open the same pages in a course of your own. The Swift program and the quiz were written for this page.

Nothing here changes a page you already have. A code block without the extra word, or a page that doesn't ask for it, is built exactly as before.


Python students can run

Mark a page with one line in its settings, add the word run to a Python block, and students get the program in an editor, in the same colours as the rest of the site's code and with its lines numbered, and a Run button. They change it, run it, and read what it prints underneath — in the browser they already have, with nothing to install and no account. A program that asks for input stops and waits: the student types the answer right in the output and presses Return, just as in a terminal.

What you type

---
codeRunner: true
---

```python run
names = ["Ali", "Bea", "Cy"]
for index in range(1, len(names)):
    print(names[index])
```

What students get

The program in an editor, with Run, Stop and Reset under it and the output below. Their changes are kept in their own browser for next time; Reset brings back yours. This is Spot the Bug, with the bug found and fixed:

A Python program on a class website's Spot the Bug page, changed so its loop starts at the first name, with Run, Stop and Reset under it, its output — Ali, Bea and Cy, one to a line — and the word Finished.
Students change the program, press Run, and read what it prints underneath.

A program that asks for input stops at each input() and waits, with its prompt in the output and a place right after it to type the answer. Return sends it and the program carries on. This is Talking to the User, answered once and waiting for its second answer:

A Python program on the Talking to the User page, run and waiting: the output shows Player name: Priya, then Minutes practised this week: with 185 being typed in a field right after the prompt, and the line Waiting for your answer under the buttons.
The program stops at each input() and waits. The student types the answer right in the output and presses Return.

An error ends in Python's own traceback, and its line numbers are the ones down the editor's left side:

A Python program on the Reading an Error Message page that asked how many hours, was answered abc, and ended in a traceback: line 2, then ValueError: invalid literal for int() with base 10: 'abc'.
Answered abc where it wanted a number. An error names the line in the editor, in Python's own words.

What it accepts

  • codeRunner: true in the settings block opts the page in. Written exactly like that.
  • ```python run makes a block runnable. A plain ```python block on the same page stays code to read, so a page can mix the two.
  • ```python run readonly runs but can't be changed — for a worked example. stdin treats a block as asking for input even when its code doesn't visibly call input(); autorun runs the block once when it scrolls into view.
  • Python's own standard library: math, random, datetime, json, csv and the rest. Not turtle or tkinter, and nothing that needs pip install.
  • A file a program writes lasts for that one run. Each Run starts fresh.
  • One program runs on a page at a time, and Stop ends any of them, a loop that never ends included.

The first Run on a page takes a moment while Python loads; later Runs start at once, until a program is stopped or another block's Run interrupts it. On paper a runnable block prints as code — the student's own, if they changed it. In Obsidian it stays an ordinary Python block.


Swift that asks, and waits for the answer

A ```swift run block runs too, on the same page setting. Swift blocks are read-only: students run the program, answer it as it asks, and run it again with other answers, and the code stays as you wrote it. Plantoir gets each Swift program ready when you preview the section, so it is waiting when a student opens the page.

What you type

```swift run
print("What is your name?")
let name = readLine() ?? ""
print("How old are you?")
let ageText = readLine() ?? ""

if let age = Int(ageText) {
    print("Hello, \(name)! Next year you will be \(age + 1).")
} else {
    print("Hello, \(name)! \"\(ageText)\" is not a whole number.")
}
```

What students get

The code, highlighted, with Run and Stop and a line saying the code itself can't be edited. Press Run, and each readLine() waits for an answer typed right after its prompt:

A Swift program on a class website, highlighted and not editable, run and waiting: its output shows What is your name?, the answer Priya, How old are you?, and 14 being typed in a field under it, with Waiting for your answer beside the No more input button.
Each readLine() waits for an answer, typed where the program asked for it.

With its answers, it carries on — the same transcript a terminal would show:

A Swift program on a class website, highlighted and not editable, answered Priya and 14, and its output: each question with its answer after it, then Hello, Priya! Next year you will be 15.
With its answers, the program carries on. The code stays as you wrote it.

What it accepts

  • The Swift students write in Grade 11 and 12: variables, loops, functions, optionals, arrays and dictionaries, structs, classes, enums and errors.
  • A whole number (Int) on the site holds up to 2,147,483,647. For factorials and big totals, use Int64.
  • No SwiftUI or anything else that needs an app or a screen.
  • A block with a mistake in it never breaks the site: it shows its code with Run turned off, and Plantoir tells you the page, the line and what Swift said.

The first time you preview a course with a Swift block, Plantoir downloads what it needs to get Swift ready — about 1.3 GB on a Mac or 2.3 GB on a Windows PC, once. After that only a block you changed is made again, in a second or two.


Questions students check for themselves

A [!quiz] callout becomes a question students answer on the site and check with one button — with your explanation once they have. It is practice, never a grade: nothing a student does leaves their browser.

What you type

> [!quiz] What does this program print?
> ```python
> for count in range(3):
>     print(count)
> ```
> - [ ] 1, 2 and 3, one to a line
> - [x] 0, 1 and 2, one to a line
> - [ ] 0, 1, 2 and 3, one to a line
> - [ ] Nothing: `range(3)` is empty
>
> > [!explain]- Why
> > `range(3)` starts at 0 and stops *before* 3, so the loop runs
> > three times, with `count` set to 0, then 1, then 2.

What students get

The question with its choices, Check and Show answer. Checked, it says whether they were right and opens your explanation:

A self-check question on a class website asking what a two-line Python loop prints, with the second of four choices picked, the word Right!, and the explanation opened under it.
A question students check for themselves, with your explanation once they have.

Every kind of question, in mathematics, chemistry and English too, and how answers are checked: Quizzes.


Or ask Claude or Codex

You don't have to learn any of this. Plantoir writes its guidance for runnable code and for quizzes into your working folder, and keeps it up to date, so Claude Code or Codex started there already knows how to opt a page in, which blocks are worth running, what to tell students to type when a program asks, and how to write each kind of question. There is nothing to install or paste.

Asked, in a working folder holding an ICS3U course, something like:

Make the examples on the page "courses/ICS3U/Concepts/Functions.md" runnable, so students can try them.

its guidance has it add codeRunner: true to the page's settings, the word run to each block worth running, and a sentence telling students what to type when the program asks. Asked to add a 5-question check to this page, it writes five [!quiz] callouts of different kinds, each with its answer.

Open either from a course's menu with Revise With ▸ Claude… or Codex…, which starts it in your working folder.