Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. def is_palindrome(s):
  2.     if len(s) <= 1 or s[0] == s[-1]:
  3.         return is_palindrome(s[1:-1])
  4.     return False
  5.  
  6.  
  7. if __name__ == '__main__':
  8.     result = is_palindrome("abccba")
  9.     print(result)
  10.  
  11.     result = is_palindrome("abccbaf")
  12.     print(result)
  13.  
  14.     result = is_palindrome("a")
  15.     print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement