- 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?')
- >>> print is_palindrome("Madam, I'm Adam Corolla.")
- >>> print is_palindrome('A_man,_a_plan, a_caremer, a canal:_Panama!')
a guest Apr 9th, 2013 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data