Class 7 · CBSE AI · Strand B — Python for AI
How to read other people's code — a real coding skill for Class 7
Developers read far more code than they write. Why reading code is its own skill, and how to get good at it. For Class 7.
Class 7 · CBSE AI · Strand B — Python for AI
Developers read far more code than they write. Why reading code is its own skill, and how to get good at it. For Class 7.
Reading a textbook by a different teacher
When you read a textbook written by someone else, you cannot ask them to explain. You read the headings first to get the structure, then the examples to understand the intent, then the details. Reading code uses the same strategy: structure first, examples second, details third.
Inheriting someone's kitchen
If you move into a house and the previous owner left a kitchen full of labelled containers and a recipe book, you can cook immediately. If they left unlabelled jars and no notes, you have to smell and taste everything before you trust it. Well-documented code is the labelled kitchen; undocumented code is the mystery jars.
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
You find a Colab notebook on GitHub that does almost exactly what you need. What is the first thing you do before running any of it?
Rote answer
"Read it to understand what it does"
Understood
"Check the imports to see what libraries it uses, read the overall structure to understand the flow, look for any code that accesses files, network, or secrets, and assess whether the source is trustworthy — running unknown code blindly is a security risk"
Stage 2 — Reasoning
When you encounter a function in someone else's code that you do not understand, what is your strategy? What would you look at first, second, and third?
Follow-up Dhee may use: What would you do if the function has no name, no docstring, and single-letter variable names? What does that code quality tell you about trusting its output?
Stage 3 — Application
Here is a 20-line function you have never seen. Without running it, write a 3-sentence explanation of what it does, what it expects as input, and what it returns. Then run it on a test case and compare your explanation to the actual output.
Misconception Dhee watches for: Assuming that if code runs without errors, it does what they think it does — without testing it, there is no way to confirm the mental model is correct
Dhee turns this concept into a 15-minute spoken session — asking, listening, and probing — so your child builds the idea themselves.
Developers read far more code than they write. Why reading code is its own skill, and how to get good at it. For Class 7.
Good programmers write code that only they can understand — in reality, writing code that others can easily read is considered a higher skill than writing clever but obscure code
Dhee opens with a question — for example: "You find a Colab notebook on GitHub that does almost exactly what you need. What is the first thing you do before running any of it?" — 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.