Coding exercises taken from "Learn Python the hard way"