anagram finder / dict mapping question

Terry Reedy tjreedy at udel.edu
Thu May 8 17:04:35 EDT 2008


"Kam-Hung Soh" <kamhung.soh at gmail.com> wrote in message 
news:op.uatraax1ev04yd at melwxp23...
| On Thu, 08 May 2008 15:42:07 +1000, dave <squareswallower at 1ya2hoo3.net>
| wrote:
| Your code is always going to return the same list because every word is 
an
| anagram of itself.
|
| Tip: Create a list for each dictionary key, then add a word to the list 
if
| that word is not in the list.  So:
|
| mapdic('adem') --> ["edam", "made"]

Unless you plan to keep the list in alphabetical order, a set might be 
slightly better.






More information about the Python-list mailing list