Sunday, August 2, 2009

Introduction to Programming Using Python

Just under a month ago I tossed the idea around of running a Saturday course to teach high school kids some programming. The idea was to take the new batch from the UCT Maths Circle and give them some exposure to programming and introduce the keen ones to our UCT Algorithm Circle. Back then I had no idea it would turn into this:

When I realised the number of new kids coming from the UCT Maths Circle might be too small, I decided to open it up for application from anyone with limited or no programming experience. All we asked for was a 100 word motivation of why they should be invited and an optional recommendation from a teacher to strengthen their application. I approached the Computer Olympiad office for a list of email addresses and postal addresses of the schools that had entered the Computer Olympiad before. We emailed about 90 schools and posted to about 60 schools with no idea of what to expect.

The advertising was sent through during the school holidays, so nothing really happened for some time. When schools started on Tuesday 28 July though, they started coming in slowly and some of the applications looked very promising. It was around this time that I started thinking of how many we could accept: I settled on 30 and asked 3 other students to help lecture/tutor. By the end of the first week of school though, applications had started flying in like mad. By the end of Monday we had received about 60 applications and they were still coming in. If we stuck at accepting 30 we would have had a shit time turning away some strong applications. Rob to the rescue as we got a fourth lecturer which allowed me to increase capacity to 40. More kept rolling in, including one application arriving on the morning of the course!

We eventually ended up inviting 46, with the expectation that at least 5 wouldn't pitch. We underestimated their enthusiasm: one fell ill, another had a last minute commitment; everyone else pitched! Even after the first day, only one kid fell ill and the rest all returned. Unfortunately a group of four girls had to leave early to catch a lift and another left as she was falling behind. Everyone else stuck it through the whole way. Not something I could possibly have expected! But it means we did something right, right? :)

We chose to run the whole course in the computer lab so that they could run short examples as we taught them things. It really worked well as we could immediately see if they were struggling on something and we never once lost them badly. We could get them to run bits of code to see for themselves what they did and then expand on how it worked.

Taking a step back a bit, on Thursday morning I got a bit of a scare. One of our lecturers had caught a bad dose of the flu, so I ran around trying to find a replacement. Fortunately some students lurking around in the Computer Science building at the time offered a hand and I split the load across three of them. I thank them all mightily for helping out at such short notice. They did a fantastic job, as did all the others that gave a helping hand. In the end it was myself and Michiel Baird doing all the admin work; the two of us, Ben Steenhuisen and Julian Kenwood doing the lecturing; then Jason Brownbridge, Bertus Labuschagne and his brother Phil and Kosie van der Merwe helped out with tutoring, answering the kids' questions; Brent Benade helped order pizza for everyone, a rather nasty job.

When the kids started arriving there was quite a lot of tension in the air, which was to be expected. We planned for this and tried to make sure that we had at least two from each school, so that there was a good chance each kid knew someone else. A number of our lecturers and tutors are great at throwing humour around, which helped ease the tension really well. By the end of the first day (3 hours) most of them had opened up and had no problem asking for help.

The topics we taught, in the order we taught them:

  1. What is programming?
  2. Using the Python interpreter
  3. Input and output
  4. Variables, operators and basic data types
  5. Boolean expressions and conditionals
  6. While loop
  7. Lists
  8. For loop
  9. Strings
  10. Writing functions
That was all covered in 9 hours. Bear in mind that these are grade 7, 8 and 9 kids (and a couple grade 10's) with mostly no prior programming experience at all! Now read the list above again. From what I can remember of my high school experience, what we taught them in 9 hours was equivalent to what is covered in the entire grade 10 and 11 IT syllabus minus files and gui's, and obviously all the theory crap.

They all did exceptionally well. Now it's time for them to write the test we gave them and we'll invite the best ones to attend weekly 90 minute classes to further teach them more on programming, especially focusing on improving their problem solving skills. What's great for them too is that they also have the opportunity of being invited to UCT Maths Circle, our partner in crime.

There is one thing we feel exceptionally guilty about. We received over 80 applications, but only had space for 46. Reading each and every one of those motivations of the kids we had to turn away makes me feel very sad. Therefore there is the possibility of us running another course like this in the near future. If you are interested in attending a future course, please contact me. We also run another class on data structures and algorithms for those who have a strong grasp of programming, are bored in class and want a challenge.


  1. Thats so awesome!
    i wish someone had done that when i was in grade 7!

  2. Woah! I wish I started doing proper programming when I was that young!

    I'm in Matric writing my NSCs at the moment. I've been accepted into UCT for BSc ComSci for 2010! :)!

    See you there next year :)

  3. Another thing I forgot to mention in my previous comment...

    That list of things you taught... WOW!
    *hats off*

    That's really impressive! In 9 HOURS!
    We wasted so much time in High School... so bullsh*t

  4. Totally random and tangential, but I came across your blog when Google searching for mine. Am now completely convinced that 'Marcos' are predominantly geeks. Me? I'm damned proud of it!

    Cheers dude.

  5. Cool. Programming (or at least simple scripting) is becoming just as an important skill as maths. To often do I see people manually going through 1000+ cells of their spreadsheet performing exactly the same operation in each. It's sad really...

    You might find this post interesting

  6. I have a lil brother who has serious math skills since a young kid,grade 11 now,but how does he access this kinda opportunity from freestate