Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Python 2.7.3 (default, Apr 27 2012, 21:06:39)
- [GCC 4.7.0] on linux2
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import re
- >>> def is_palindrome(i):
- ... i=''.join(re.findall('[a-z0-9]+',i.lower()))
- ... return i==i[::-1]
- ...
- >>> print is_palindrome('Eva, can I stab bats in a cave?')
- True
- >>> print is_palindrome("Madam, I'm Adam Corolla.")
- False
- >>> print is_palindrome('A_man,_a_plan, a_caremer, a canal:_Panama!')
- True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement