Base case: Empty string or single character is a palindrome. Recursive case: First equals last, and middle is palindrome. python def is_palindrome(s): if len(s) <= 1: return True if s[0] != s[-1]: return False return is_palindrome(s[1:-1]) Tracing is_palindrome("racecar"): ```plaintext is_palindrome("racecar") → 'r' == 'r'?
Yes → is_palindrome("aceca") → 'a' == 'a'? Yes → is_palindrome("cec") → 'c' == 'c'? Yes → is_palindrome("e") → len <= 1, return True ``` Each call strips the outer characters and checks the middle.