Completes worksheet 2.2.6 in the Python tutorial