← Code

Apps with Gradio

Turn your Python into apps people can click.

Start1. Your first app
For teachers Usually Years 9–10 · 3 lessons (and 2 optional)

Turn Python functions into apps with inputs and outputs: a greeter, a calculator with several inputs, and a quiz built from a list of questions, in an in-browser stand-in for Gradio that runs the same code as the real thing.

  • Usually Years 9–10
  • Lessons 3 (and 2 optional)
  • Do first Console bridge: text in, text out
Teacher guide

Standards, in general: main focus: Trace algorithms for errors (8P06). What this means

First apps

A function plus inputs and outputs makes an app; more inputs mean more parameters, in the same order.

1Your first appNot started

Turn a Python function into an app you can click, in an in-browser stand-in for Gradio that runs the same code as the real thing.

  1. Predict
  2. Run
  3. Investigate › No brackets
  4. Investigate › A tick box
  5. Investigate › Spot the bug
  6. Modify › How excited?
  7. Modify › A second output
  8. A tiny tool
  9. Where this leads
Start lesson
2More inputs, more outputsNot started

A movie-night calculator with sliders, a dropdown and two outputs: each input is a parameter, each output a returned value, all in order.

  1. Predict
  2. Run
  3. Investigate › What each input gives
  4. Investigate › Tidy numbers
  5. Investigate › Spot the bug
  6. Modify › Popcorn
  7. Modify › Seats
  8. Your own calculator
  9. Where this leads
Start lesson

A quiz app

Questions as data, an input made for each one, and a function that marks the answers.

3A quiz appNot started
4A class for questions OptionalNot started

Store each question as an object of your own class, Question, with a check method, so each question knows how to mark itself.

  1. Predict
  2. Run
  3. Investigate › Whose answer?
  4. Investigate › What mark lost
  5. Investigate › Spot the bug
  6. Modify › Hints
  7. Modify › Points
  8. Your quiz with objects
  9. Where this leads
Start lesson
5A quiz with a scoreboard OptionalNot started

Save every quiz score in a SQLite database, and show the top scores in a table that is still there after the app restarts.

  1. Predict
  2. Run
  3. Investigate › Ties
  4. Investigate › Why a database?
  5. Modify
  6. Make
Start lesson

Project how-tos

Help for your own project. Open the one you need.

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)