( to ) ? be : ! be;
sidebar left sidebar right

Word arithmetic puzzle generator (1,620 views)

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.

The “word arithmetic” script can generate such puzzles given a word list and characters.
Here is the code and a sample word list.

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.

Sample output

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
...
...
subscribe to feed

Tags: , , ,

"Word arithmetic puzzle generator" was published on August 26th, 2007 and is listed in programming, python.

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

Subscribe without commenting

224,332 views

Prashanth Ellina is powered by WordPress

No Complaints Shifter Series Theme by Buzzdroid.com
Computers blogarama - the blog directory Blog Flux Directory Blog Directory & Search engine Computer Blogs - Blog Catalog Blog Directory Computers blogs Bloggeries Blog Directory blog directory Computers Blog Blog Search, Blog Directory p Listed in LS Blogs the Blog Directory and Blog Search Engine Blog Review Blog search - categorized blog directory Link With Us - Web Directory Find Blogs in the Blog
Directory Blog Directory