Matt Lerner
Matt Lerner

I wanted to expose my kids to programming because it’s a great skill and a powerful way of thinking. And my kids spend enough time playing Angry Birds and Cut the Rope on my iPhone that I figure they should get a peek behind the curtain at how programming works.

So whether you’ve never programmed before or you’re a hardcore HAx0r (hacker), here are some tips on teaching your kids to program.

Tip #1 Logo Still Rocks

When my oldest son Cy was four we started writing some Logo programs on the iPad using Mad Logo and making some animations using the kids programming language Scratch.

But to really give Cy a peek behind the curtain, I came up with some tricks to teach him Python programming. Python is readable enough for a kid to understand and powerful enough that we use it for almost everything at my startup Walk Score.

Tip #2  Python Is Already Installed On Your Mac

Did you know that Python is already installed on your Mac?  All you need to do is open the Terminal application and type python to get started (type ctrl+d to exit Python).  Learn Python the Hard Way has everything you need to start programming in Python.

Tip #3 Make the Computer Talk

Here’s my main hack to get kids to pay attention, make the computer talk!  This is super easy on a Mac.  Open the Terminal application and type “say hello.”  The computer says, “hello.”  Magic!

Tip #4 The Number Guessing Game

Here’s some code for a number guessing game in Python.  To run this program:

1.  Download the source code

2. Open the Terminal application

3. In the Terminal application type: cd Downloads

4. Type: python mathquiz.py (make sure your volume is turned up on your speakers!)

Since this is a real guessing game, my son Cy liked to just play it at first  — and eventually got interested enough that we could walk through each line of the program to talk about how it works.

Open this file with a text editor (I’m using Sublime but you can use the built in TextEdit application on your Mac) and try changing max_number to 100.

 

Tip #5 The Internet Has Everything Else You Need

Let’s say you want to teach your kids about a more mind-blowing programming concept like recursion.

Don’t remember what recursion is?  Or in my case, I’m wondering how the heck I explain something this complicated to a kid?!  Khan Academy to the rescue!  Here’s a great video from the Khan academy explaining a recursive factorial program.

And here’s the code I used with my son Cy.  At 6 years old, I think he’s too young to understand recursion but he sure likes seeing the computer make really big factorial numbers!

I’m sure there’s some six year old somewhere who has already made a million dollars selling an iPhone game that they programmed themselves. But to be honest, my kids haven’t started writing any programs of their own.  In fact, I’m not even sure they’re interested in programming!

But my son Cy has gotten obsessed with math concepts like factorial because of this little exercise and more importantly he’s seen that programming is something that anyone can do! Check out Code.org for a wealth of resources on teaching and learning programming.

Matt Lerner is the CTO and Co-founder of walkscore.com.  Follow Matt on Twitter.

Comments

  • http://blog.calbucci.com/ Marcelo Calbucci

    This is fantastic Matt. Thanks for sharing!

  • Kish

    Love this! I would like to learn Python myself, but will also share this with friends with brainy kid-sponges. :)

  • http://wandermom.com WanderMom

    I bought ‘Python Programming for the Absolute Beginner’ (http://www.amazon.com/Python-Programming-Absolute-Beginner-Edition/dp/1435455002) for my son when he was in 5th grade. He carried it with him everywhere for years.
    We were recently working on his college applications (he’s now a senior) and he listed this as one of the books that has had the most influence on his life.
    He’s already done a developer internship and is applying to study CompSci.

  • http://douglastarr.com/ Douglas Tarr

    This is great. I will be using #4 in the coding class I am teaching.

  • Kate Knight

    Matt – great article!! If you haven’t already checked it out – take a look at Hopscotch: https://www.gethopscotch.com/ designed and built by two dear friends of mine in nyc, it’s 100% for parents and kids with exactly your challenge, and has been getting great feedback in the appstores. Have fun and lmk what you think, KQK

  • Brian Campbell

    That’s awesome! I haven’t thought of using Python before. I’m signing my 4th grader up to take a Scratch and Java course at iD Tech Camps next summer. http://www.idtech.com/kids/tech-camps/courses/intro-to-programming-with-scratch-java/. Programming is so powerful and I’m looking for any way to expose my kids to it and pique their interest.

Job Listings on GeekWork