Python solutions to basic problems