DC LoCo

DocTest Quiz

Goal:

DocTests provide a wonderful tool for teachers of Python to use to communicate with students. A simple DocTest can replace several paragraphs of ambiguous text with a clear, open-ended question that tests student understanding and promotes student learning. A simple example question illustrates this approach:

Question 1: Write just enough Python code to make the following DocTests pass:

a. """
     >>> p = Animal()
     >>> p.name
     ''
     >>> p.friends
     []
   """        

b. """
    >>> p = Animal('Pooh')
    >>> p.name
    'Pooh'
    >>> p.addFriend('Piglet')
    >>> p.friends
    ['Piglet']
   """        

To solve (i.e. make the tests pass) the tests above students need to understand elements of classes, instance variables, strings, lists, and methods. Not only does this approach make communication clearer, but it lends itself to automated testing of student solutions.

With a bit of work, we could have an entire first year intro CS curriculum using Python and integrated with exercises, quizes, and tests using this approach that would empower students to move at their own pace through the course getting important and accurate automatic feedback from the system on their progress.

Requirements:

The most challenging part of this specification is finding a way to safely run arbitrary Python code which has been input through a web browser. We need a server-side sandbox for this purpose.