I have written this code
def is_palindrome(word): if len(word) == 0 or 1: return True if word[-1] != word: return False if word[-1] == word: word = word.replace(word[-1], '') word = word.replace(word, '') return is_palindrome(word)
to check whether something is a palindrome and it feels (to me at least) like a recursive code. However, it won’t let me pass and displays this error message:
is_palindrome()so that it uses RECURSIVE calls. Do not use iteration!
Could someone explain why my code is not a recursive one? Thanks