Attempt at Kata 6

11 PM June 11, 2003

I had a go at PragDave’s Kata 6 in Python. Finding and printing the anagrams took 11 lines, not counting blank lines and comments. (code)

The next two bits of the challenge—finding the longest anagram and the set with the most anagrams in it—added 9 more lines. A comparatively ugly 9 lines they are too. Two more lines were needed to print the total number of anagrams and the total number of sets of anagrams. (code)

It runs pretty quick too. Running over Dave’s 45,000 word dictionary takes less than a second on my Athlon 2000 (1.66GHz), including the Python interpreter startup.

Anybody tried this in another language and want to compare notes?

By alang | # | Comments (0)
(Posted to Software Development)
© 2003-2006 Alan Green