My youngest son asked me if I would show him how to program, so for his twelfth birthday I gave Max a copy of Al Sweigart's book Invent Your Own Computer Games with Python. (You don't have to buy the book: you can download the full PDF for free.)
A couple of weeks later and I'd say it's working out pretty well: Max is enjoying typing in the programs from the book and there is often laughter when they run.
Each chapter gives a complete Python program and a line-by-line commentary explaining what all the parts of the program do. The programs start very simple and grow in length and complexity.
He generally calls me when he wants to do some Python and I sit with him and help him find the mistakes he's made entering the programs. I also run quickly through the line-by-line commentary in the book: I don't dwell on it because it's not that important to him right now. I do like the way the book gives things their proper names: it doesn't feel dumbed-down (in my opinion) yet it's pitched so that a twelve year-old can use it.
Almost immediately Max tried out his own ideas.
print('hi what is your name?')
myname = input ()
print ('nice name, '+myname)
print ('my name is python')
print ('wich console do you use? pc xbox or a wii')
console = input ()
if console == 'wii':
print ('oh cool i use a wii to!')
print ('so you use a '+console+'? i use a wii')
print ('what is your favourite sport')
sport = input ()
if sport == ('i dont like sport'):
print ('realy? me too')
print ('so you like '+sport+' i dont like '+sport+' although to be honest i dont like any sport ')
Once we'd seen how to loop Max was off again laughing at the huge numbers we could make with things like this:
n = 1
n = n * 2
I like the fact that in Python this just works for as long as we wanted - the numbers getting page-sized - and I didn't have to explain why the number suddenly turned negative and then zero, as I might have if this was C++. He might take such a complication in his stride, but at this point in his programming career I think he is just not that interested in those kind of details.
We are only about a quarter of the way through the book but so far he hasn't had too much trouble following along. As the programs increase in complexity I hope they will maintain his interest as the novelty wears off. Like many young people in my culture he pretty much takes amazing computer games for granted.