Created
November 16, 2014 04:18
-
-
Save admwrd/6b66ca14778dfce279a0 to your computer and use it in GitHub Desktop.
MB character Palindrome check. Does not work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! env python3 | |
names = ['Julio', 'racecar', 'umbrella', 'Madam', u'すます', u'😃😜😞😜😃', u'😃😜😞😜'] | |
def pali(word): | |
#word = alphaonly(word).lower() | |
print(word+"?") | |
for i in range(0,(int)(len(word)/2)+1): | |
if word[i] is not word[(i+1)*-1]: | |
print(word[i]+", "+word[(i+1)*-1]+" do not match.") | |
return False | |
return True | |
def alphaonly(word): | |
import re | |
#return re.sub('[^a-zA-Z]','',word) | |
return word #re.sub('[!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~]','',word) | |
[print(str(pali(name))) for name in names] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment