Python solutions for programming exercise for "Problem Solving with Algorithms and Data Structures"