python interview problem