Skip to content

Instantly share code, notes, and snippets.

@admwrd
Created November 16, 2014 04:18
Show Gist options
  • Save admwrd/6b66ca14778dfce279a0 to your computer and use it in GitHub Desktop.
Save admwrd/6b66ca14778dfce279a0 to your computer and use it in GitHub Desktop.
MB character Palindrome check. Does not work
#! 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