Recursive Function Program In Python To Check