How I explain loops with appam batter (and why my children remember it in the board exam)
Contents
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
Sign in to join the conversation.
Sign in to comment