Governor's Career & Technical Academy Arlington

Introduction to Computer Science: Week 6


Since I won't be here with you on Thursday, we are going to plan our work this week to make best use of that situation. We will use Tuesday's class for an introduction to Python's unittest module, and do an exercise together using it with Test-driven development (TDD).

Thursday, February 13th

Classwork / Homework

Dear CSC 200 students,

I had a chance to at least briefly vet the two resources to which I linked last class, and it turns out that python-tdd-exercises is much closer to our purpose. So here is what I want you to do in my absence today:

  1. Create a subdirectory in the new tddexperiments git repo you made with your partner last class named feb13.
  2. Inside the feb13 directory copy the two files I've added to my csc200 repo here.
  3. Run the test with:
        $ python3 -m unittest test_python_tdd_exercises.py
    and confirm that you get the following failure:
        AssertionError: None != [5, 4, 3, 2, 1]
  4. Write a function body for reverse_list that makes the test pass. Hint: the following will work:
        reversed = []
        for item in lst:
            reversed = [item] + reversed
        return reversed
  5. Repeat this process, adding a test from python-tdd-exercises to TDDExerciseSuite, and then adding a function to the python_tdd_exercises.py module to make the test pass, as class time and homework time allows.

Warning! Please remember to add a link to your tddexercises repo from a README.md file in your csc200 repo which should be linked here. A quick check revealed most of you have not done this. Leila has, so you can see her repo for a working example. Without that link I will have nothing to evaluate and you will receive a failing grade for the assignment!


To receive an A for this assignment, you need to have a series of commits in your git repo both during class and between the end of class and the beginning of class next Tuesday showing you used the TDD process.

Tuesday, February 11th


We will begin by choosing new pairs for the activities for the next few weeks, then we will do an activity together introducing Python's unittest module by writting code to score a bowling game.

We will do this together in class, and among the tasks will be:


Choose a mini project from the resources below, and use TDD and pair programming to develop a solution.



You will be evaluated on your git repo, which should show a clear TDD progression, with tests added first to the test file and then code being added to the python module to make the tests pass.