Class 7 · CBSE AI · Strand B — Python for AI
What is a function? Explained without code — for Class 7
A function is a named recipe that takes inputs and returns one output. The idea before the Python syntax. For Class 7.
Class 7 · CBSE AI · Strand B — Python for AI
A function is a named recipe that takes inputs and returns one output. The idea before the Python syntax. For Class 7.
Chai recipe at home
make_chai(water_cups, sugar_spoons, milk_ml, time_minutes) → glass_of_chai. Same recipe, different inputs, same kind of output.
Vending machine at railway station
You put in 20 rupees + button code → out comes a cold drink. The machine is a physical function: input → output, no surprises.
Every Dhee Learning session for this concept follows three stages. We share the questions Dhee actually asks, so you can hear what a session sounds like.
Stage 1 — Surface
Think about a tea-making at home. You add 1 cup water, 2 spoons sugar, milk, leaves — out comes chai. If we named this recipe 'make_chai', what would we 'put in' and 'get out' every time?
Rote answer
"A function is something in code."
Understood
"A function is a named recipe — you put in some things (inputs), it does the steps, and gives you back one finished thing (output)."
Stage 2 — Reasoning
Why is naming the recipe 'make_chai' more useful than writing the 5 steps every time you want chai?
Follow-up Dhee may use: Think of one other named 'recipe' in your home — like packing tiffin, or locking up at night. What are the inputs, what's the output?
Stage 3 — Application
On paper, write down a recipe called 'mark_attendance' for a classroom. What inputs does it need? What does it return? Then trace what happens if it's called for Anjali, Vikram, and a student who's absent.
Misconception Dhee watches for: Thinking a function must involve a computer — it's really just a named, repeatable procedure with clear inputs and outputs.
Dhee turns this concept into a 15-minute spoken session — asking, listening, and probing — so your child builds the idea themselves.
A function is a named recipe that takes inputs and returns one output. The idea before the Python syntax. For Class 7.
Thinking functions only exist inside programming — everyday routines are functions too.
Dhee opens with a question — for example: "Think about a tea-making at home. You add 1 cup water, 2 spoons sugar, milk, leaves — out comes chai. If we named this recipe 'make_chai', what would we 'put in' and 'get out' every time?" — listens to your child's answer, then probes the reasoning behind it. The session ends when the child can apply the idea to a brand-new situation, not just recall it.