RosettaCodeData/Task/Palindrome-detection/Python/palindrome-detection-3.py

8 lines
141 B
Python
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
def is_palindrome_r(s):
if len(s) <= 1:
return True
elif s[0] != s[-1]:
return False
else:
return is_palindrome_r(s[1:-1])