14 September 2008

Advice Requested: Teaching Python to an 8-year-old child

I want to teach my little 8-year-old cousin Python. Her dad says she's only just getting used to Windows. I'm giving her an old laptop running Edubuntu to practice on (so her environment is similar to mine), and I'll be teaching her through email correspondence since I go to school away from home. I figure Edubuntu will be good for two reasons. First, she'll have education games. Second, her mom's a teacher and might like it. Anyway, I need some recommendations.

It has been suggested that I try PyStart. Anyone have experience with it? How does it do on testing for correctness of code? Is it likely to be total overkill? I suspect the answer to that one is yes.

I normally recommend How to Think Like a Computer Scientist: Learning With Python for learning Python as a first language, but the book was written for a class of high-schoolers. My feeling is that some of the math examples might be too advanced. On the other hand, maybe I could just give her different examples. The only book I've seen suggested for young kids is Snake Wrangling for Kids. Has anyone used this to teach an elementary-schooler Python? How'd it go? Any other suggestions?

Finally, development environment. I'm a vim user. I like the command line. I'm also not crazy. I'm not spending time teaching an 8-year-old vim before she can do any programming. The only Python IDE I've used is Idle, which isn't much more than Gedit with a run button. I'm looking for suggestions on easy-to-use (but hopefully still featureful) Python IDE. It's an older laptop, so it'd also be best if it's something smaller than, say, Eclipse.

Thanks for any input, guys!


ffm said...

Maco, I thought you hated python?

In any case, take a look at "Dr. Python".

nhaines said...

Well, IDLE is the most lightweight IDE, but another very comfy one is SPE (Stani's Python Editor). It's in universe but it is written in Python and is a bit fat.

Mackenzie said...

I'm extremely uncomfortable with Python's syntax...or lack thereof...but for a beginner, to minimize teaching of syntax and maximize teaching concepts, Python seems like the right choice. It just feels very uncomfortable for me because I'm very much used to Java idioms due to 4 years of using it. I won't deny that Python is easier to read, I just get thrown for a loop every time I try to write it. Apparently Python uses the word "not" instead of "!" ...weird.

Daniel said...

For an IDE, I recommend Geany. Easy, versatile, and cross-platform. Not just for python either, I also use it for HTML, PHP, CSS, bash scripts. Pretty much replaced gedit since it is fast enough.

0iKcmaEnnZETSwYUX09J19lOHgH_vA-- said...

An oldie (but goodie) thread:


jeremy said...

I think the best way to teach it is not in theory, but hands-on.

Write an example script with that does lots of different things -- print statements, addition, subtraction, maybe even make a beep. Then, tell him he can modify it in any way he wants.

He'll learn by tinkering. He might not understand why changing a particular value makes the output change, but he knows that it does.

It's the same way we learn our native tongue. When we're babies, how do we learn how to speak? We can't be told how to speak.

jldugger said...

My advice: don't. Eight years old might be a bit early for advanced language stuff. Scratch is a neat visual programming language that physically enforces type constraints. It's similar to LOGO with the graphics emphasis.

By far the biggest hurdle for kids this age is qualified instruction. As I reflect on my own experience, elementary teachers were the least likely people to be exposed to programming and computers in general, and most afraid of breaking them. You should do just fine, of course. If you take a graphical approach, take a moment to find ways to represent more classical problems like trees and sorting.

pasqoo said...

this should be the last version of Downey's book about python: http://www.greenteapress.com/thinkpython/thinkpython.html
maybe it's under working.. but you can download the pdf. i don't have a good english knowledge but this "Think Python" is good also for me, maybe you can try..

stemp said...

I agree with jldugger.
In Hardy there was a junior-programming package with :
. gvrng : http://gvr.sourceforge.net/
. kturtle : http://edu.kde.org/kturtle/
. littlewizard : http://littlewizard.sourceforge.net/

slashdotaccount said...

Could you please fix your feed to not truncate itself on Planet Ubuntu?

tuxmaniac said...

http://gnuvision.com/books/pybook/ <- May be you can try this.

Rickyniano said...

What about Ruby? IMHO, it has a cleaner & simpler syntax than Python, and there's a superb book about learn to program with Ruby: Learn to Program.

Take a look!

Nikolas Coukouma said...

I'm surprised Hackety Hack hasn't been mentioned...

I started programming when I was 6 or 7, and the most important thing to me was just being able to do something neat. Subtraction, beeps, and just printing text isn't neat. A text adventure game was. So was drawing an octopus, and being able to write/play simple tunes. Those kept me going for hours.

If I were going to present a pedagogical program to a child now, I'd make it something they could work on from the inside out; the little changes to variables and control flow should have interesting results.

Try to provide tools that will let them accomplish their goals. I stopped programming for a while because I got no closer to making the games I wanted to (no C compiler, all books about writing games were in C).

ffm said...


You might want to iluse one of those languages for children, such as Etoys, Scratch, or Alice. While narrow in scope, they explain concepts well.

Sa4gCVEYneqVGZjgEGhcY6tbaXYSOA-- said...

The olpc project is working on an application that aims at teaching children Python mostly by learning on their own. It's called Pippy:


You could still use edubuntu and install Sugar from sugarlabs.org which comes with Pippy installed. I don't know, how complete it is but I should guess it could work.

Price H said...

I started programming at 9 years old, and taught myself completely after my father showed me basic on a Radio shack trs-80 model II.

The most important thing to realize when teaching a child under 10-11 or so (it varies per child) is that they have not yet reached the stage of formal operations. They are able to think logically, but require a concrete connection - their ability to abstract is limited.

Stick to procedural code, and let them explore where they will. I would recommend graphics coding, which may seem strange since a lot of the setup for that is difficult. But the fact that you can make a change to the code, then SEE the result, makes it work.

Try pyglet (http://pyglet.org). Write a skeleton program that she can modify in a straightforward way. If she's ready, it will take off.

encompass said...

PyStart is a good program to teach programming, IF your a teacher. If not, it's not going to help you.
It's made so that the teacher can create assignments and then give the assignments to the student. He completes them and submits the completed assignment back to the teacher. The assignment is partially graded when she gets it.
So if your trying to learn it yourself, this proegram is not for you. And this is coming from the guy that made it. :D
As for a nice ide to use. I use geany. It's lightweight, simple and has the basic tools needed to make a better programming experience. The one thing I wish it had was a way to keep a python console open at the end of a program run, to test variables and other what not.

Mackenzie said...

I can't send a full-feed to Planet and still have the short one on here. There are some sites that take RSS feeds and have software to automatically copy all posts to their own blog. They do this with individual sites, and they do it to Planet. Since I found this out, I stopped using full-feeds.

Mackenzie said...

Well I don't know any Ruby at all, but I do know some Python. Given the one attempt made at teaching me RoR, I don't think I'll ever learn it. Maybe on its own one day, but Rails confuses me. Too much automagic code-generation.

Mackenzie said...

I think that's actually the first edition, the one Downey and Elkner worked on together. The one I linked is the 2nd edition, the one Elkner's writing.

Phil said...

One of the things, that always keep me away from learning another language (either programming, or spoken one) is that I'm not motivated enough. So, I think if you can motivate her enough, and find some good examples, you should be good to go!

Beau said...

I remember wanting to program games and I remember typing code out of magazines in BASIC and my vic 20 when I was a kid.

I ended up stopping because I couldn't make the games I wanted. But it taught me how computers work, how they step through a process.

Now, many years later (I have kids of my own), I've been able to learn HTML, PL/SQL and shell scripting mostly on my own.

I would make the suggestion that its not the language that is taught, but it is the thought processes that will make a kid "technologically successful" down the road.

Thats my two cents.

Rickyniano said...


Please, don't confuse Rails with Ruby. Rails is a killer-app with tons of magic. It isn't obvious at all. Ruby, however, is a programming language, a very clear an easy to learn programming language. You could see several alternatives and get the best that fits your needs ;-)


skymt said...

Turtle graphics (a la LOGO) is a proven way to teach programming to youngsters. It's an easy model to understand but gives quick results. Conveniently enough, Python has a turtle graphics system in the standard library! Read up on the turtle module, and consider basing your first few lessons on it.

ffm said...


Taking that one step further, we have TurtleArt as part of Sugar.

Rolandixor said...


my advice, don't! use gambas or something lol.

keturn said...

A few years back David Bau wrote a wonderful piece on introducing his six-year-old son to programming in Python. http://davidbau.com/archives/2005/07/29/haaarg_world.html

Brandon Corfman said...

I agree with the others here who think that Python is NOT the right level for an 8 year old. Your idea of fun != hers.

I recommend Stagecast Creator (http://www.stagecast.com/) which was written with young children in mind. It is enjoyable for them and gets the concepts across on their level. The programs they create can also be used on any OS or on the Web, which is important for kids to share their creations with their friends/family.

James Gray said...

I am using gedit as my editor for python right now. It doesn't have everything, but it has enough. I recommend any simple editor. Having too many options/buttons may be confusing to a beginner. Better to keep things simple.

I used to use fancy IDEs when I was programming C++, but since I started doing most of my programming in python I've slimmed down a lot. I find I just don't need a fancy IDE, I can run and debug from the command line. Sure the pdb module can be useful for debugging, but usually well placed print statements more quickly help you narrow things down.

I recommend you use examples from her own interests as programming projects. Programming is frustrating when you are first starting. If she is working on a project that has meaning for her personally she's more likely to stick with it. Solving math and business related exercises out of a book may loose her interest.

Let us know how it goes.

Dan said...

Try the turtle module:

from turtle import *

You'll have all the Logo goodness (forward, backward, left, right, penup, pendown, etc.) but in Python. It was made for situations like yours.

Lynoure said...

I love Python, but for someone who is just 8, maybe a programming toy like http://www.alice.org/ would be better suited.

AlSweigart said...

I have the exact solution for you. I wrote a book (available for free online under a Creative Commons license) that is aimed at teaching Python programming to young adults and kids through complete game examples.


The book is "Invent Your Own Computer Games with Python". Each chapter gives the complete source code for a simple game (Guess the Number, Hangman, Tic Tac Toe, etc.) and then teaches the programming concepts from the source code. I got tired of seeing programming books for kids that were just dead listings of syntax and functions. People want to learn programming to actually do stuff with it, but they need some examples to draw upon.

I've received very positive feedback on the book so far, so hopefully you can make use of it.

Lukas said...

You can try http://rur-ple.sourceforge.net/en/rur.htm

More oriented like a game and teaches the basics of programming, not just Python.

Foster Grant said...


1) Is this her idea or yours? Because if it's not her idea, it ain't gonna work. And if it is her idea, she might change her mind.

2) I agree with the posters who say Python might be slightly high-end for an 8-year-old who's still figuring out Windows. Something like LOGO or Karel might be a better choice. Stanford uses Karel tools to teach its CS students the basics of Java, which is now getting wider exposure in the Stanford Engineering Everywhere initiative.

2a) There's a Karel-like tool called Guido van Robot which uses the Karel syntax and methods to teach Python.

3) I like the Eclipse IDE, but that's just me. It doesn't do LOGO or basic Karel but does do Java and Python (and also C/C++, but that's beside the point).

Mackenzie said...

I told her a few months ago that I was thinking about teaching a little Python class to kids between 10-13 years old, but that if she wanted to learn too, I figured she could sit still long enough to learn, and she said she'd like it. If she doesn't think making the computer do tricks is fun, oh well, and if she does, yay.

waylandbill said...

I remember programming at that age. It was on a C-64. It was ahead of it's time with 64kB memory. I love python. IDLE works. ERIC is nice if you already have Qt and may be using PyQt. Vim, Gvim, Gedit, Kate or any other text editor is just as good as many times debugging can come from a strategically placed print statement.

PoLtS said...

I think it is fantastic that you have chosen Python for your kid. Since you are using a Linux machine, I highly recommend that you use geany as the editor. Indenting is taken care of automatically, and it is a good editor (not just for Python). I suggest that right now, you should concentrate on teaching her the basic data structures, and when to use them. If taught with examples, it is possible for a 8 year old to understand when to use a dictionary, versus a list. Her math background should not be an issue.

Rupesh said...

Please try RURPLE. It is a python learning environment. Kids can learn python by playing games. Please try