Guess the Machine
Sec 1 to Sec 2A function is a machine: something goes in, something comes out. Probe it until you can predict it, then write the rule as one line of Python using x.
Machine A
Evidence
Every probe you run is kept here. Read down the columns and look for the pattern.
No evidence yet. Send something into the machine.
Your rule
One line of Python, written in terms of x. For example x * 2 + 1, len(x), x[0:3] or x % 3 == 0.
Guess the Machine
Probe a sealed function until you can predict it, then write the rule as one line of Python. Suits Sec 1 to Sec 2. Teaches functions, inputs and outputs, and testing a hypothesis in Python.
What this teaches, and who it suits
Guess the Machine is a free Python puzzle for Secondary 1 and Secondary 2. Each machine is a sealed function: feed it a number or some text, record what comes out, and keep probing until the pattern is clear. Then write the rule as one line of Python in terms of x and run it against the machine's hidden tests. Failing cases are shown one at a time, so a near-miss points straight at the input that broke the rule. It teaches what a function really is, plus operators, string slicing and testing, without any setup or install.
It is free to play, needs no account and runs in the browser on a phone, tablet or laptop. Nothing a child makes is stored on our servers: a shared link carries the work itself.