The 30-Second Trick That Makes Kids Care About Code

Michael Murr··7 min read

Last updated: June 2026

The 30-second trick that makes kids care about code is to replace the generic example in the lesson with something the kid is obsessed with. That is it. The whole trick. It takes about 30 seconds to find the obsession, another 30 seconds to swap it into the code, and the result is a kid who locks in for the next hour instead of fidgeting through it.

This is not a motivational hack or a cute pedagogy. Instead, it is the single highest-leverage move I make as a tutor, every session, with every kid I teach. After 20+ years and 200+ kids, the kids who care about code are the kids whose tutors do this. The kids who do not are the kids whose tutors do not.

Key Takeaways

  • Replace if car == "BMW" with if Harry > Voldemort and a Harry Potter kid will focus for the rest of the lesson. That is the entire trick.
  • The whole pivot takes about 30 seconds. Most tutors do not do it because the lesson plan does not require it.
  • 5 questions are enough to find any kid's hook before a session starts. Parents can ask them at home.
  • This is not "making coding fun." This is making coding personal, which is a different and more durable thing.
  • A tutor who will not personalize examples is teaching the curriculum, not your kid.

Table of Contents

The Harry Potter if-statement

A few months ago I was teaching a 9-year-old who was glazing over inside the first 10 minutes of a Python lesson. The example in the textbook was the standard one. Something like:

car = "BMW"
if car == "BMW":
    print("Nice car!")

He did not care about cars. Furthermore, he had no relationship with the word BMW. The line of code may as well have been written in Latin.

I asked him one question. "What is the thing you are most into right now?" He said Harry Potter. I changed two words on the screen.

if Harry > Voldemort:
    print("Harry wins!")

He sat up. He asked what the greater-than sign meant. He asked what happens if Voldemort is stronger. He spent the next 20 minutes writing if-statements about wand strength, house points, and which spell beats which. He learned everything the original lesson was supposed to teach. He learned it because the code was about something that already lived in his head.

That is the 30-second trick. The pedagogy is identical. The example is replaced. Everything else changes.

Why this works (and why most tutors skip it)

The mechanism is simple. Kids have limited working memory. When the example in a lesson is about something they do not care about, they spend half of their attention parsing the example. They burn cycles on what a BMW is, who buys one, and why the lesson cares. Meanwhile, the other half goes to the actual code. As a result, they run out of attention before the concept lands.

However, when the example is about something they already think about constantly, the parsing is free. They already know who Harry and Voldemort are. They already have opinions about who would win. Therefore, all of their attention is available for the new concept, which is the code itself. That is the entire mechanism.

Most tutors skip this because:

  1. The lesson plan does not require it. Curriculum vendors write examples that work for "average" kids, which means no specific kid.
  2. They are pattern-matching from textbooks. Every textbook uses cars, food, or weather. Tutors copy the textbook because the textbook is the path of least resistance.
  3. They do not actually ask the kid what they are into. Or they ask once at intake and never update it. Obsessions change every few months for a kid this age.

The tutor who personalizes the example every session is not doing anything clever. They are just doing the basic work of teaching a specific human being. That work happens to be the single biggest motivation lever in the entire job. The research backs this up: a meta-analysis published in the Journal of Educational Psychology found that personalized math problems boosted student performance by roughly 0.4 standard deviations compared with generic versions of the same problems, with the strongest effects in elementary-age learners. That is a large effect size for a 30-second change.

For more on motivation in general, see How to Keep Kids Motivated to Learn Coding.

The 5 questions that find any kid's hook

This is the actual script I use, and I tell parents to use it too. Five questions, in this order, will find any 8 to 12 year old's current obsession in about 90 seconds.

  1. "What is the last thing you watched or read that you would watch or read again right now?"
  2. "If you could only play one game for the next month, which would it be?"
  3. "Who is your favorite character in anything, a show, a game, a book, a YouTube channel?"
  4. "What is a thing you keep talking about that nobody else cares about?"
  5. "If I asked your best friend what you are obsessed with right now, what would they say?"

The fifth question is the cheat code. Kids are often shy about naming their obsession themselves, but they are happy to predict what their friend would say. The friend's answer is usually the real answer.

Once you have it, you have everything you need. For example, a kid into basketball: every conditional becomes if score > opponent. A kid into Pokemon: every variable becomes pokemon_health. A kid into Stranger Things: every loop iterates through the kids in the party. The concept does not change. The wrapping does.

Concrete examples by interest

Here is the swap, by common kid interest, for the three concepts kids hit most early. These are the exact substitutions I use in real sessions.

ConceptGeneric textbook exampleHarry Potter kidBasketball kidMinecraft kidPokemon kid
If-statementif temp > 30if Harry_strength > Voldemort_strengthif score > opponent_scoreif diamonds >= 1if pokemon_health > 0
Variableage = 10house_points = 50points_scored = 3xp_level = 12pokemon_level = 25
Loopfor i in range(5)for spell in spellbookfor shot in three_pointersfor block in stackfor pokemon in team
Functiondef greet():def cast_spell():def shoot_freethrow():def mine_diamond():def battle_move():

Two notes on this table. First, the kid does not need to understand all of it to benefit. Even just changing the variable names is enough to flip their focus. Second, this is not babying. The Python syntax is identical to what they would see in a professional codebase. We are just using nouns they already own.

Sarah, a parent whose daughter learned Python with me, summed up what she noticed. The daughter had bounced off two prior tutors. The first session that worked was the one where I asked what she was watching and then built every example around it. After that, she would come to her desk early just to keep going. Same kid. Different examples. That is the whole change.

How to use this at home, even if you do not code

Most parents reading this do not code, and that is fine. Honestly, you do not need to. You just need to do the question-asking part and give that information to whoever is teaching your kid.

Three concrete moves.

Before any tutoring session, ask your kid what they are into this week and text or email the tutor a one-liner. "Maya is obsessed with Wings of Fire dragons right now." A good tutor will weave that into the next session within the first 10 minutes. A bad tutor will ignore it. Either way, you have learned something useful.

When evaluating a tutor, ask them directly: "Do you change your examples based on what each kid is into, and how?" Listen for specifics. A tutor who says "yes, of course" without a story is bluffing. A tutor who says "yes, last week I had a kid into Roblox so I built our list lesson around Roblox avatars" is doing the work. For more on tutor evaluation, see How to Choose the Right Coding Tutor for Your Child and The Best Kids Coding Tutors Build Lessons Around Your Kid's Obsessions.

Between sessions, when your kid talks about a coding project, ask "what is it about?" If the answer is generic (a calculator, a quiz, a counter), the tutor is teaching the curriculum, not your kid. If the answer is specific (a Pokemon damage calculator, a Minecraft inventory tracker, a Stranger Things quote generator), the personalization is happening. Research from MIT's Lifelong Kindergarten group on the original Scratch project (scratch.mit.edu/about) consistently finds that personally meaningful projects are the single strongest predictor of sustained engagement in kids. That is the same finding, framed academically.

For more on getting a kid interested in the first place, see How to Get Your Child Interested in Coding.

Frequently Asked Questions

How do I find out what my kid is obsessed with if they will not tell me? Use the fifth question first: "If I asked your best friend what you are obsessed with right now, what would they say?" Kids will predict a friend's answer when they will not state their own. If even that does not work, look at their YouTube history, their drawings, what they ask for at Christmas, or what they reread. The obsession is almost always visible from outside.

Will my kid ever need to learn the "real" examples, or is this just a starter trick? Both. The personalized examples are not a starter trick, they are how the kid learns the concept properly. Once the concept is internalized, they will recognize it in any context, including the boring textbook ones. A kid who first learned if-statements through Harry vs Voldemort has no trouble later applying them to temperature, age, or score. The opposite path does not work as well.

My kid changes obsessions every few weeks. Do we have to keep rewriting the examples? Yes, and that is fine. It is 30 seconds of work per session. The tutor (or you, if you are guiding at home) just asks at the start of each session what the kid is into now. The current obsession becomes the lesson's example set. Old projects do not need to be rewritten, they stay as they were when the kid built them.

Is this only for kids who are reluctant to learn coding? No. This works on highly motivated kids too. A kid who already loves coding will love it more when the examples line up with their interests. The technique is universal. The reluctant kids just show the strongest visible improvement because their baseline engagement is lowest.

The Bottom Line

The 30-second trick is not about making coding fun. Coding does not need to be fun. It needs to be personal. The minute the example on the screen is about a thing the kid already cares about, the lesson stops fighting the kid's attention and starts riding it.

Has your kid's tutor ever asked what they are obsessed with this week? Book a free Discovery Call and we will start the first session by finding the hook your kid actually cares about.

Enjoyed this article?

Your child can learn this and more with a dedicated 1-on-1 tutor.

Book a Free Discovery Call