blendtutor Demo Book

A demo Quarto book with R and Python blendtutor exercises.
Author

blendtutor

1 Welcome to blendtutor

This demo book shows how to author interactive coding exercises with the blendtutor Quarto extension.

Each chapter contains exercises in R or Python. Learners write code in an in-browser editor, run it against checks, and get instant feedback.

1.1 Prerequisites

  • Quarto >= 1.4
  • The blendtutor extension installed via quarto add mcmullarkey/blendtutor

1.2 BYOK (Bring Your Own Key)

AI-powered feedback requires a Fireworks API key. Enter it once on the API key page — the book stores it in your browser’s localStorage and sends it only in an Authorization: Bearer header to api.fireworks.ai. No server-side key needed.

Serve the book over HTTP — the key page and exercises use localStorage and ES modules, which file:// blocks. Run python3 -m http.server 8000 from demo-book/_output/ and open http://localhost:8000.

1.3 Exercise 1: Double function (R)

Write a function double(x) that returns twice its input.

Exercise 1

Write a function double(x) that returns x * 2.

double <- function(x) { ___ }
HintsUse the `<-` operator to assign the function body.

1.4 Exercise 2: Triple function (Python)

Write a function triple(n) that returns three times its input.

Exercise 2

Write a function triple(n) that returns n * 3.

def triple(n):
    ___