Recursive Program In Python To Check