Skip to content
experience

How I explain loops with appam batter (and why my children remember it in the board exam)

Anitha Joseph@anitha_miss

September 29, 2026 · 3 min read

Fourteen years of teaching Python to higher secondary children in Kochi has taught me one thing: they will forget the definition, but they will never forget the story. So here is the story I use for loops. Other teachers are welcome to steal it.

The appam pan

Every child in Kerala has watched their amma or ammachi make appam. You have a bowl of batter and an appachatti (the round pan). One ladle of batter, swirl the pan, cover, wait, take it out. Repeat until the batter is finished.

I draw this on the board, and then I write it like this:

batter = 20          # ladles of batter in the bowl
appams = 0

while batter > 0:
    batter = batter - 1   # one ladle into the pan
    appams = appams + 1   # one appam comes out
    print("Appam number", appams, "is ready")

print("Batter finished. Total appams:", appams)

Then I ask: what happens if amma forgets to take the ladle of batter out of the bowl? The children shout "infinite appams!" and everyone laughs, and that is how they learn what happens when you forget to update the loop variable. I have had children write "infinite appam" in the margin of their board exam answer next to a while loop. The examiner probably did not understand. But the child got it right.

Then the for loop

Next class: "Now amma is making appam for exactly 6 guests, 3 each."

for guest in range(1, 7):
    for appam in range(3):
        print("Guest", guest, "gets appam", appam + 1)

Nested loops, explained with guests at a wedding. Somebody always asks why range(1, 7) stops at 6. I tell them: the 7th guest came late, so no appam. They remember this too.

What I have learned

  • Use the food they eat at home. In my class, appam, idli, parotta. A teacher in Punjab will do better with rotis.
  • Let them predict the output before running. Prediction first, then the computer. Wrong predictions teach more than correct ones.
  • Make the bug funny. A child who laughs at the infinite appam will never write that bug again (they will write different bugs, of course).

Small confession: this year many children submitted record work written by ChatGPT. I could tell because every program had perfect comments and nobody's amma was in any of them. I made them all explain one program out loud. Viva questions are still the best AI detector I know 😄

Get the best of Dynamo Geeks weekly

One email each Monday with the most useful posts. No spam; unsubscribe in one click.

Comments

8

Sign in to join the conversation.

Sign in to comment
Lakshmi Prasad@lakshmi_teaches_py
Respected Anitha madam, this is wonderful. I teach in Mysuru and I am going to use dosa instead of appam, if you permit. The "7th guest came late" explanation for range is brilliant. Thanking you.
0 net votes
Anitha Joseph@anitha_miss
Lakshmi ma'am, of course! Dosa is perfect, maybe even better because the tawa makes a nice sound for each loop. Sheri, let us exchange more of these 😄
3 net votes
Nikhil Sharan@nikhil_twopointers
Anitha ma'am, this is exactly how loops should be taught. Dry run with appams. "Prediction first, then computer" is the single most important habit, I say the same thing for DSA. bas itna sa concept hai 🙏
2 net votes
Rhys Llewellyn@rhys_teaches_code
Bore da from Cardiff! I'm stealing this, with Welsh cakes on a bakestone. "Nobody's amma was in any of them" is the best AI homework detector I've heard of, and the best line I've read this term. Tidy.
1 net votes
Meenal Deshpande@meenal_restarts
My son is in Class 9 and I just made him read this. He said "why can't our teacher teach like this". Anitha, please start a YouTube channel.
2 net votes
Anitha Joseph@anitha_miss
Ayyo, no YouTube, I am too shy for the camera 😄 but tell your son to predict the output first, every time.
2 net votes
Grace Wanjiru@grace_wanjiru
Teaching Python in Nairobi, and we will do chapati. Thank you for sharing such a practical method.
3 net votes
Frank Ostrowski@frank_cpp98
Python, but correct, and the off-by-one explanation is better than most textbooks. Regards.
3 net votes