I need to define a recursive function to check if a string is a palindrome.
Below's my code:
def palindrome_recur(string):
if len(string)==0 or 1:
return True
else:
if string[0] == string[-1]:
return palindrome_recur(string[1:-2])
else:
return False
It passes a few test cases, but doesn't work for the string "chipmunks"
. Can anybody tell me what I might have overlooked?