Skip to content

Instantly share code, notes, and snippets.

@kierendavies
Last active December 12, 2015 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kierendavies/4738488 to your computer and use it in GitHub Desktop.
Save kierendavies/4738488 to your computer and use it in GitHub Desktop.
finds words which are mirror-image palindromes in elian script
#!/usr/bin/python3
# find words which are mirror-image palindromes in elian script
with open("/usr/share/dict/words", encoding="utf-8", errors="ignore") as fin:
words = [word.strip().lower() for word in fin.readlines()]
sub = {'i': 'c', 'h': 'b', 'k': 'q', 'j': 'p', 'm': 'm', 'l': 'r', 'o': 'o', 'n': 'n', 'a': 'g', 'c': 'i', 'b': 'h', 'e': 'e', 'd': 'd', 'g': 'a', 'f': 'f', 'y': 's', 'x': 'x', 'z': 't', 'q': 'k', 'p': 'j', 's': 'y', 'r': 'l', 't': 'z', 'w': 'w', 'v': 'v'}
for word in words:
subbed = ""
for l in word:
if l not in sub: continue
subbed += sub[l]
if subbed == word[::-1]:
print(word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment