Python solutions to 165