Python and Raspberry Pi in education

Register or Login to like
Raspberry Pi and Python

Raspberry Pi Foundation. CC BY-SA 4.0.

We love Python at the Raspberry Pi Foundation—it's our go-to general purpose programming language for most projects and activities. Our home-brewed, Pi-optimized Linux distribution Raspbian (a Debian variant) ships with a number of different languages and educational tools (Scratch, Ruby, Java, C, Wolfram, Mathematica, and, of course, the numerous others available in Linux), but the one we and many others tend to choose is Python.


Python's syntax is not dissimilar to pseudocode. It uses English keywords and avoids unnecessary grammar to make code easy to write and easy to read. The principles of the language's purpose and the constraint in keeping it aligned with its original aims make it a very suitable first language for any new programmer—and a great tool for educators to use to teach programming and computing concepts with simple code.

Physical computing and IoT

Want to drive a robot? Or control a robotic arm? Or build an embedded control panel? Or make a sous-vide machine? You can use Python for all of these! There's no need to write in C just because you're talking to hardware—Python and its collection of libraries are there to make your life easier. Physical computing is a powerful tool in education as it's so engaging and empowering for young people to be in control of things in the real world, be creative with technology, and dive into the internet of things.

A Raspberry Pi

Raspberry Pi Foundation. CC-BY 4.0.

Two notable Python libraries on Raspberry Pi are RPi.GPIO (for accessing the GPIO (general purpose input output) pins) and picamera (for controlling the Raspberry Pi camera module). There's also the Minecraft Pi API.

As well as on desktops, servers, and micro computers like Raspberry Pi, Python now even runs on a microcontroller called MicroPython. The European Space Agency recently announced they will be funding further development of MicroPython to determine the suitability of the language for space-based applications.

MicroPython microcontroller

George Robotics Limited from micropython.orgCC-BY 4.0.

 Full stack

You can use Python for web programming, GUI development, scientific and numeric programming, software development, systems administration, and more. Most importantly, it's cross-platform, multi-architecture, and even runs on multiple backends. The main implementation is in C, but it also runs in the JVM, on the .Net framework, and there's a JIT (just-in-time) compiler for it written in Python (PyPy uses a restricted subset of Python called RPython) that makes it run super fast. You can't argue Python isn't useful in the real world or in industry—it's everywhere.

Python Community

Python has a great community of engineers, developers, and educators who create, teach, and share. It's a really friendly community both online and in real life. PyCon is the big international Python conference that takes place in North America each year, and there are other such events that take place all over the world.

Increasing numbers of these conferences are putting on education-focused tracks—PyConUK has done this for a number of years, where teachers are invited and given the chance to apply for a bursary for their travel and accommodation. Teachers get the opportunity to meet with developers to ask questions and share problems they face, and can work collaboratively on furthering the possibilities they can provide their students with. PyConUK also has a day of activities for children—with workshops on Raspberry Pi and the chance to play with Python-programmed robots.

Next month EuroPython takes place in Bilbao, Spain, and for the first time there's going to be an education summit—talks and workshops by and for teachers, an education-themed sprint, and a gathering for teachers and educators to share their experiences.

Python Software Foundation

Like Raspberry Pi, the Python project is wholly owned and led by a nonprofit organization—the Python Software Foundation. The PSF has a board of elected directors, and its purpose is to promote, protect, and advance the Python programming language as well as support and facilitate the growth of the international community of Python programmers.

Python in Education (free ebook)

PyConUK organizer Nicholas Tollervey was asked to write a short book, Python in Education, which you can download for free from the O'Reilly site. The book, which was launched at PyCon in Montreal earlier this year, provides a great summary of why and how Python is used in schools, and it contains information for programmers, teachers, students, and parents.

Raspberry Pi

This article is part of Ben Nuttall's Raspberry Pi column, where he shares news and stories from the world of tiny computing.

User profile image.
Ben is a software engineer for BBC News Labs, and formerly Raspberry Pi's Community Manager. He's into Linux, Python and all things open source! Follow Ben on Twitter @ben_nuttall.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.