Sunday, March 30, 2014

Recursion For Kids

There's a bunch of 9th graders at my son's school talking about recursion.  They're not learning this in class.  It's just something to do.   I'm fascinated by their decision to dig into one of the fundamental ideas of computer science on their own.

For kids, recursion is simply calling a function from itself.  It's an easy concept to understand and can be used to create powerful examples in under 15 minutes.

Some of my son's friends entered into a programming contest as a group and won it.  I'm continually impressed with 9th graders.  They're tough, both mentally and physically.  I can't keep up with the teens.  Just as an example of how far behind I'm lagging, all the 14 year old programmers are also running under 5 minute miles for track.  They're fast!  Where do they get all the energy?  I don't think I could finish a mile in under 9 minutes now day with all my injuries.

Since recursion is a hot topic for kids, I introduced recursion to my son.  Here's a recursion example he wrote today.

More examples:


  1. Hi Craig,

    Thanks for your blog. I have studied pygame and PGS4A this month, and had big trouble to port my pygame to Android. I was almost giving up, but wanted to give a last shot yesterday. Because pygame is very easy tool to create a GUI app. Luckily, I found your blog yesterday somehow, and read your post about update to PGS4A 0.9.6 and trouble shooting.

    I just followed what you mentioned and tried to port again. Then? WOW! It worked like magic!! I could not believe my eyes. I almost screamed when I saw the main screen of my pygame on my phone.

    I will recommend your blog to other people. Once again, thanks for your posting.

    1. Jin, thanks for the nice comment. I enjoy my hobby of working with my children on python programming. It's great that the lessons are also useful to other people. If you have additional questions, you can also ask them on my test forum.