Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_palindrome(s):
- if len(s) <= 1 or s[0] == s[-1]:
- return is_palindrome(s[1:-1])
- return False
- if __name__ == '__main__':
- result = is_palindrome("abccba")
- print(result)
- result = is_palindrome("abccbaf")
- print(result)
- result = is_palindrome("a")
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement