Data structures and problem solving in python