[Tutor] Algorithm

Mac Ryan quasipedia at gmail.com
Mon Aug 24 15:01:15 CEST 2009


On Sun, 2009-08-23 at 15:06 -0700, kreglet wrote:
> Hello,
> 
>   The problem that I am having is writing an algorithm for finding all the
> possible words from a given word. For example: python
> 
> from "python" you can make the words pot, top, hop, not etc. There are few
> examples for making anagrams for a word, but only the whole word. I have
> tried unsuccessfully to modify some of these to suit my purpose. Also on the
> web there are numerous sites where you can type in a word and it will give
> you a list of all the words that could be made from it. How would I go about
> this in python?
> 
> thanx,
> kreglet

Of course doing things by yourself is more exciting and fun (and above
all you have the pleasure to learn something new), but if you finally
should decide to invoke an external utility (e.g.: for performance
issues), then you might be interested in using "an": it's very fast and
in the repositories of most linux distro. It has plenty of options.
Example usage:

an -m4 -w python [search only for single words in the dictionary with a
minimum length of 4 letters] returns:
hypo
phony
pony
python
tony
typo

Good luck with your project,
Mac.



More information about the Tutor mailing list