Teaching with Python Koans

Blog

Teaching with Python Koans

Intro

How to teach introductory programming? It is a question that keeps many programming teachers occupied and has been a topic of scientific research from the seventies to more recent days.

Not only the choice of programming language and the topics of exercises are of interest, but also the form of teaching. Do we try to explain programming concepts by explaining the logic of each concept. For example, saying that a loop is a form of repetition, which has this form in Python:

for i in range(10):
    print(i)

This is usually the way programming is taught, explaining concepts and then asking of students to apply them.

However, there are alternative methods. As Seymour Papert said “Learn a concept by applying it, rather than explain first and apply then” This is formalized as ‘discovery learning’ where students explore a space and discover the rules. Programming seems an excellent topic for discovery learning, which is exactly what we have tried.

This course is a course for non-computer science majors, which brings a few interesting additional problems to a programming course. Firstly, students come in with very diverse experience, from being able to compile their own kernel to not knowing how to use a computer. Since there are no programming courses in many high school programs around the world, these two extremes gather in introductory programming courses. Secondly, we would like to avoid too much context of programming. Some students might be excited by the prospect of programming itself, but many want to use programming in their own field, hence traditional examples like list sorting might not be all that engaging.

Our setup

There is a known method that is similar to discovery learning, called Koans. Koans were originally created for Ruby but have since been recreated for many other programming languages, including Python. The name Koan comes from Zen and is a test administered to a student.

We have adopted the Python Koans to fit the learning goals of our course, which includes learning about variables, classes, OOP and functions. All Koans were imported into edX, using an online coding tool called Stepik. Important in the setup was also that after each Koan, students needed to fill out their learning from the coding, in order for them to reflect on the process.

The students saw the Koans and learning outcome questions like this:


The course was ran in a flipped way, students worked on the Koans before class, and in the lecture we discussed their difficulties. The code for the Koans is on Github, the course itself runs on edge (by edX).

Strengths

In general, the course worked well. Students were engaged with the content and filled out the Koans and learning results seriously. Initially we worried that student would fill out bogey responses, but they did not.

As an example, here are some results for the first Koan:

The great strength of the Koans is that they are truly discovery learning. As you can see from the answers, rather than telling students that Python is case sensitive, students discover this.
It is however not entirely free from discovery learning (which is known to not be very effective) since the Koans are small and focused. It also helps to mitigate the effects of students with previous knowledge, they can learn other things for the Koans.

Weaknesses

Not all students liked the free form of the puzzles, some would have preferred a more structured explanation. There were even two students that followed some lessons on CodeAcademy to deepen their understanding of concepts before doing the Koans. In a next iteration of the course we plan to link to some background lessons which students can follow if they want to.

 

 

Back To Top