I was digging through some old code of mine when I came across this script. To me, this script was a demonstration of the beauty and elegance of the python language.
You might have come across a puzzle like this: AID + ICED = IDEA. What digits would you assign to the characters A,C,D,E,I so that the arithmetic will work? The answer is A=0, C=4, D=5, E=1, I=2.
Running the script:
python word_arithmetic.py --words-file words --letters AEIBCDFGHI
In the command above you are asking the script to generate word combinations where A=0, E=1, I=2, B=3 and so on.
letters = A=0, E=1, I=2, B=3, C=4, D=5, F=6, G=7, H=8, I=9 FEE + AHA = FIE DACCA + BEEBE = HEDGE ACHED + AHA = CHID BIG + BAH = GAD BIB + ACED = HAH DADA + HIE = DICE BIG + CAF = AHAB ABB + CHE = DEC AID + ICED = IDEA ... ...