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

Word arithmetic puzzle generator (3,864 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.

Comments on "Word arithmetic puzzle generator": 2 Comments

  1. Andrea Sender wrote,

    I’ve been wishing I knew enough programing to generate the “Word Arithmetic” puzzles I love to solve. They are Long Division problems, where the numerals 0-9 are replaced by letters such that a word devided by another word results in a third word. The rest of the letters needn’t form words except that when the puzzle is solved the letters arranged 0-9 make a word or a phrase.
    I can make them myself, but only by using much trial and error which a computor would be able to do better and faster. I only know a little basic which is not enough to write the code though I see how it can be written. Would you be intested in writing such a program?
    Sincerely yours,
    Andrea Sender

  2. DARCEL DAVENGER wrote,

    0 1 2 3 4 5 6 7 8 9

    WHITTLE/HALT = TIE

    HOW DO I SOLVE THIS USING WORD ARITHMETHIC: DIVISION

558943 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