Answer:
The function is as follows:
def _isPalindrome(stri) :
if len(stri) == 0:
return True
if stri[0] == stri[len(stri) - 1]:
return _isPalindrome(stri[1:len(stri) - 1])
else:
return False
Step-by-step explanation:
This defines the function
def _isPalindrome(stri) :
If the string is empty, then it is palindrome
if len(stri) == 0:
return True
This checks if the characters at alternate positions are the same.
If yes, it calls the function to check for other characters
if stri[0] == stri[len(stri) - 1]:
return _isPalindrome(stri[1:len(stri) - 1])
If otherwise, the string is not palindrome
else:
return False