Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isPalindrome(s):
- def toChars(s):
- s = s.lower()
- ans = ''
- for c in s:
- if c in 'qwertyuiopasdfghjklzxcvbnm':
- ans += c
- return ans
- def isPal(s):
- if len(s) <= 1:
- return True
- else:
- return s[0] == s[-1] and isPal(s[1:-1])
- return isPal(toChars(s))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement