Python in Education – free e-book from O’Reilly

This week PyCon is going on in Montreal – it’s the big worldwide Python conference – and for the occasion, O’Reilly asked our friend Nicholas Tollervey to write a free short book on Python in Education.


Click to download the book for free

The book tells the story of Python, why Python is a good language for learning, how its community gives great support, and covers Raspberry Pi as a case study.

You’ve probably heard about the computing revolution in schools, and perhaps you’ve even heard of the Raspberry Pi. The Python programming language is at the center of these fundamental changes in computing education. Whether you’re a programmer, teacher, student, or parent, this report arms you with the facts and information you need to understand where Python sits within this context.

Author Nicholas Tollervey takes you through the features that make Python appropriate for education, and explains how an active Python community supports educational outreach. You’ll also learn how Raspberry Pi is inspiring a new generation of programmers – with Python’s help.

Nicholas visited Pi Towers in February to speak to Carrie Anne, Eben and me about why we think Python is suited to education. He asked Eben how the idea for the Raspberry Pi hardware came about and why there was a need for an affordable hackable device. He asked us about the Python libraries those in the community provided (particularly RPi.GPIO and picamera) that we consider part of our infrastructure for education and hobbyist users alike; and about the sorts of projects that engage, empower and inspire young learners – and of course the way they learn and progress. We discussed Minecraft Pi, hardware projects, Astro Pi, PyPy, teacher training and more.

Read more on teaching with Python from Nicholas and download the book for free from O’Reilly.



Looks Good!


IS good!


Nice. Looking forward to the read.


Looks great – not that I’m biased with my daughter being on the front cover and in the acknowledgements :-)

Nicholas has been the organiser of the Raspberry Pi related education days at Pycon UK which my children really enjoyed.

Those that have programming experience and experience teaching children about programming will already know why Python is a great programming language for use in education, but this guide provides the explanation for those without that background knowledge.


There is an example of how difficult Perl is in the book. I found the fuller example on
# look for duplicated words in a line
perl -0777 -ne ‘print “$.: doubled $_\n” while /\b(\w+)\b\s+\b\1\b/gi’ foo.txt

But how does one write a program that does the same in Python in one line? or if this is not possible, what is the shortest Python-program that does this? (This -0777 seems to make Perl ignore line-feeds, see )


That Perl one-liner only works for me if I change it to:

perl -ne 'print "$.: doubled $1\n" while /\b(\w+)\b\s+\b\1\b/gi' foo.txt

and the smallest Python script I was able to create that does the same thing is:
import re

for i,l in enumerate(open('foo.txt')):
    for s in re.findall(r'\b(\w+)\b\s+\b\1\b',l,re.I):print str(i+1)+': doubled',s

I’d obviously never normally write such condensed code ;) Perl contains lots of “shortcuts” which makes writing compact one-liners much easier, although the more shortcuts you use, the less readable the code becomes.


An excellent little introduction. Obviously biased, but justifiably so and articulate.

(My only quibble would be the James Joyce analogy: The 3rd chapter of Ulysses is excellent for teaching the importance of punctuation.)


Look nice for encouraging


What about .NET support on these boards? Since .NET is open source now, has the community made any progress with .NET on a raspberry Pi? I personally prefer C# over python which is why I’m looking forward to more .NET support for raspberry pi.


Looks like should point you in the right direction… ?

Or you could ask over in the

Leave a Comment

Comments are closed