Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_palindrome(word):
- if len(word) == 0:
- return True
- if len(word) == 1:
- return True
- if word[0] == word[-1]:
- return is_palindrome(word[1:-1])
- else:
- return False
- is_palindrome("racecar") # True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement