Re: word shifts

2008-05-05 Thread Arnaud Delobelle
George Sakkis <[EMAIL PROTECTED]> writes: > On May 5, 11:02 pm, dave <[EMAIL PROTECTED]> wrote: >> On 2008-05-04 01:10:40 -0600, Arnaud Delobelle <[EMAIL PROTECTED]> said: >> >> >> >> > dave <[EMAIL PROTECTED]> writes: >> >> >> Hello, >> >> >> I made a function that takes a word list (one word per

Re: word shifts

2008-05-05 Thread George Sakkis
On May 5, 11:02 pm, dave <[EMAIL PROTECTED]> wrote: > On 2008-05-04 01:10:40 -0600, Arnaud Delobelle <[EMAIL PROTECTED]> said: > > > > > dave <[EMAIL PROTECTED]> writes: > > >> Hello, > > >> I made a function that takes a word list (one word per line, text > >> file) and searches for all the words

Re: word shifts

2008-05-05 Thread dave
On 2008-05-04 01:10:40 -0600, Arnaud Delobelle <[EMAIL PROTECTED]> said: dave <[EMAIL PROTECTED]> writes: Hello, I made a function that takes a word list (one word per line, text file) and searches for all the words in the list that are 'shifts' of eachother. 'abc' shifted 1 is 'bcd' Please

Re: word shifts

2008-05-04 Thread Gabriel Genellina
En Sun, 04 May 2008 03:35:05 -0300, George Sakkis <[EMAIL PROTECTED]> escribió: > On May 4, 2:04 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Sun, 04 May 2008 02:17:07 -0300, dave <[EMAIL PROTECTED]> escribió: >> >> > I made a function that takes a word list (one word per line, text fil

Re: word shifts

2008-05-04 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: > George Sakkis: >> A faster algorithm is to create a 'key' for each word, defined as the >> tuple of ord differences (modulo 26) of consecutive characters. > > Very nice solution, it uses the same strategy used to find anagrams, > where keys are > "".join(sorted(word)) >

Re: word shifts

2008-05-04 Thread bearophileHUGS
George Sakkis: > A faster algorithm is to create a 'key' for each word, defined as the > tuple of ord differences (modulo 26) of consecutive characters. Very nice solution, it uses the same strategy used to find anagrams, where keys are "".join(sorted(word)) Such general strategy to look for a pos

Re: word shifts

2008-05-04 Thread Arnaud Delobelle
dave <[EMAIL PROTECTED]> writes: > Hello, > > I made a function that takes a word list (one word per line, text > file) and searches for all the words in the list that are 'shifts' of > eachother. 'abc' shifted 1 is 'bcd' > > Please take a look and tell me if this is a viable solution. > > def sh

Re: word shifts

2008-05-04 Thread Peter Otten
dave wrote: > I made a function that takes a word list (one word per line, text file) > and searches for all the words in the list that are 'shifts' of > eachother.  'abc' shifted 1 is 'bcd' > > Please take a look and tell me if this is a viable solution. > >  def shift(word, amt): > a

Re: word shifts

2008-05-03 Thread George Sakkis
On May 4, 2:04 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 04 May 2008 02:17:07 -0300, dave <[EMAIL PROTECTED]> escribió: > > > > > Hello, > > > I made a function that takes a word list (one word per line, text file) > > and searches for all the words in the list that are 'shifts'

Re: word shifts

2008-05-03 Thread Gabriel Genellina
En Sun, 04 May 2008 02:17:07 -0300, dave <[EMAIL PROTECTED]> escribió: > Hello, > > I made a function that takes a word list (one word per line, text file) > and searches for all the words in the list that are 'shifts' of > eachother. 'abc' shifted 1 is 'bcd' > > Please take a look and tell me if

word shifts

2008-05-03 Thread dave
Hello, I made a function that takes a word list (one word per line, text file) and searches for all the words in the list that are 'shifts' of eachother. 'abc' shifted 1 is 'bcd' Please take a look and tell me if this is a viable solution. def shift(word, amt): ans = '' for