2013-03-20

At PyCon 2013 this past week, I was fortunate to be able to pair up with Katie Cunningham to teach two 1-day workshops for young and aspiring programmers:

The Young Coder: Let's Learn Python

On the first day, we taught younger students aged approximately 10-12, and on the second day we had a group of 13-16 year olds.

This type of class had never before been taught at PyCon, but teaching and building towards the future of the language were pervasive themes this year so the timing was perfect.

The teaching tools

Raspberry Pi

Thanks to a deal struck between Jesse Noller and the Raspberry Pi Foundation, all of our students were working on Raspberry Pis (which they were allowed to take home after the class).

The RPis were perfect, simple computing machines for the lessons we were teaching, but we discovered that we had to keep examples simple - once the kids learned how to perform math and string operations they started pushing the limits of their little RPis' processing power by trying operations that could force memory errors (such as multiplying a string by a very large number). I don't think you'd ever see that kind of experimentation in a classroom full of adults, who would more likely do everything in their power not to break their computers, but these kids were fearless with their experimentation. And besides, when the machines got bogged down, it was simple enough to unplug and reboot.

In conjunction with these tutorials and some of the other RPi related events at this year's PyCon, the PSF also contracted this site from Caktus Group as a place to find and share projects that you can build with your own Raspberry Pi:

raspberry.io

Idle

We used the Raspbian OS on pre-imaged cards that contained, among other things, a terminal app and a few different Idle clients, which caused a bit of confusion.

I did enjoy teaching with Idle in spite of some of its limitations - I think that when I teach this class again, I'd like to make more of an effort to explain the differences between Idle and a regular Python shell. Also, the slides I developed for this class were written with the shell in mind, so I managed to confuse the first day's students until we figured out what was going on (I didn't realize until we were well into the material that they were all using Idle, so the indentation I was using in my examples required a little bit of explanation).

Books

We also sent our students home with two books, again thanks to generous sponsor donations:

Python for Kids: A Playful Introduction to Programming

"Hello World! Computer Programming for Kids and Other Beginners

Curriculum

Aside from a few minor tweaks, the material we used was the same on both days.

Designed to be taught in one day

The model we used was to start simple and gradually add more complex terms and concepts along the way. That did leave students with some heaver concepts to deal with at the end of a long day when their brains were tired, but we built in time at the end to allow the kids to play around with the new coding skills they'd learned, so they all still seemed pretty energetic and inspired when the day ended.

Beginner level class

You'll see that this is a beginner level class and not a complete overview. There is a limit to the amount that we felt we could teach in a day, so we had to make deliberate choices about what to include and what to leave out, trusting that the students will learn about those concepts later as they continue their self-education.

Open-ended

We had no idea how quickly or slowly our young students would learn, so the class was deliberately open-ended - we figured that if we covered the material in less than the time allotted, we could spend the extra time reviewing more code samples (you'll see that the repository where the slides are housed also contains a state capitals quiz and a number guessing game).

Our original plan was to spend the first half of each day working through the slides, then the last half reviewing Katie's game code and having her put her extraordinary live coding skills to work showing the kids new examples.

As it actually worked out, with the group of younger students we got through the full set of slides and had just enough time to review Katie's Raspberry Rogue code and the number guessing game before the class ended.

But with the older group, it only took about four hours to get through the slides. With the last half of the day, we covered Raspberry Rogue and the other game examples, then added some off the cuff discussion of open source, and pointed them at a few additional learning resources that they could follow up with (LPTHW and Coding Bat).

Comprehensible

The same material was comprehensible for students of different ages and experience levels - the only notable difference was the amount of time it took for each age group to work through everything.

In fact, the slides were adapted from materials that I developed for an adult Intro to Python class. My theory is that a beginner is a beginner, and that once children have reached an age where their brains are developed enough to comprehend abstract concepts, they're capable of learning what an adult would. (I should point out, though, that the kids need a little more humor and energy in the delivery to keep the material engaging.)

If you want to teach a class

I was pleasantly surprised when people asked, after the tutorials were over, if we would be open sourcing the slides and game code. Everyone I talked to expressed some interest in taking these materials back to their communities and using them to teach kids in their local schools and user groups. I'm so in favor of that.

Resources

If you do decide to teach a kids' class, getting the physical resources will be the biggest hurdle. I would recommend looking into getting a bulk order of Raspberry Pis - besides being simple to set up and guaranteeing that each student has a workstation, sending the kids home with them is a great way to give them a head start and ensure that they'll continue to be interested in computing down the road.

Of course, to be complete, you'll also also need monitors, keyboards and mice, as well as HDMI cables, micro-USB power supplies, etc. I'm no expert on Raspberry Pi setup, but there is a quick start guide here that should get you started. The cards should be fairly cheap to buy in bulk, particularly if they're not pre-imaged (you'll have to decide if you're willing to do the work yourself and maybe save some money). And for the Young Coder tutorial at PyCon, we rented the peripherals - look for computer accessory or office supply rentals in your area.

Books and projects

Finally, if you can't get book donations, be sure to recommend a few follow up projects for when the kids get home.

The LPTHW exercises are probably simple enough for a young student to get through.

Invent Your Own Computer Games with Python is free online, and includes a Pygame tutorial.

Python Tutorials for Kids 8+ has some fun example exercises, although they're presented in blog format, so they're not in any particular order.

Take your time

Where there are examples in the slides:

Give the students time to type and run examples themselves

Then switch over to Idle and demonstrate the examples for them

Be sure and give the students time to catch up after each exercise. Young students won't be able to type as quickly as you do. We saw some students struggle and then give up if we moved too quickly. After each new exercise, do something like getting a show of hands to confirm that everyone's getting it before you move on to the next topic.

And whatever you do, don't make the mistake I did on the first day and give the kids variable names that are miles long. I thought I was being uber-descriptive, but instead I was just adding typing time that would have been better used on understanding.

Incidentally, once the kids know that they can type along, they'll try to type everything exactly as shown until they get comfortable enough to play around.

Take breaks

Build in plenty of breaks for bathroom and snacks (and to give yourself some time to regroup), and give students some hack time to experiment with their new skills.

Enlist volunteers

Volunteers are crucial - each student has unique needs and levels of understanding, so with both age groups, we relied heavily on one-on-one help to get the students through some of the tougher concepts. A 1:3 ratio of students to volunteers would not be overdoing it.

The one thing that we asked was that volunteers wait until break times to make remarks about the content. We felt that it was important to avoid derailing the class with interruptions, and that any errors or missed content could be taken care of later. We wanted to keep the focus on the students, rather than on the slides.

The materials

Here are the slides - fork and remix them in whatever way you wish:

http://github.com/mechanicalgirl/young-coders-tutorial

Some code samples are included in that repo, but Katie's game code is here:

http://github.com/kcunning/Katie-s-Rougish-PyGame

And if you have questions, feel free to contact either of us. I can be reached at barbara dot shaurette at gmail dot com, and you can find Katie Cunningham contact information through her blog: http://therealkatie.net

For next year

The kids were so excited about learning - I have no doubt that this will be one of the most talked-about tutorials in the Python community for some time. And although there are no specific plans in the works yet, I feel certain that we'll be doing it again in Montreal in 2014.

The biggest change I'd like to see for next year is the addition of more teachers. I think that we should continue teaching in teams of two, but have each team do just one class instead of two in a row (but still have all the teams coordinate on the materials).

And I want to find a better way to explain Booleans to kids. Algorithms were easy - peanut butter and jelly sandwiches! But why do I feel like it's so difficult to explain something as simple as True and False in a way that's both clear and fun? Ah well, that's just one of the things I'll be working on in the coming weeks.

Show more