Working out the exercises from learnpython.org in ipython-notebook