Re: I need algorithm for my task

2014-11-06 Thread Jussi Piitulainen
Denis McMahon writes: On Thu, 06 Nov 2014 15:14:05 +1100, Chris Angelico wrote: On Thu, Nov 6, 2014 at 3:00 PM, Denis McMahon wrote: def baseword(s): find shortest sequence which repeats to generate s return s[0:[.join([s[0:x]for k in range(int(len(s)/x)+1)])[0:len (s)]for x in

Re: I need algorithm for my task

2014-11-06 Thread Darren Chen
Probably homework, you are a good man ! -- https://mail.python.org/mailman/listinfo/python-list

Re: I need algorithm for my task

2014-11-05 Thread Chris Angelico
On Wed, Nov 5, 2014 at 10:58 PM, lordvita...@gmail.com wrote: I have line 'pythonpythonpyth'. How do I know which word is the foundation line?. Other examples: pythonpythonpyth is python DOLORIUMD is DOLORIUM HELLOLHELLO is HELLOL thewordword is thewordword I need to know whether the

Re: I need algorithm for my task

2014-11-05 Thread Peter Otten
lordvita...@gmail.com wrote: I have line 'pythonpythonpyth'. How do I know which word is the foundation line?. Other examples: pythonpythonpyth is python DOLORIUMD is DOLORIUM HELLOLHELLO is HELLOL thewordword is thewordword I need to know whether the word in the text is repeated and get

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
On Wed, 05 Nov 2014 03:58:33 -0800, lordvital21 wrote: I have line 'pythonpythonpyth'. How do I know which word is the foundation line?. Other examples: pythonpythonpyth is python DOLORIUMD is DOLORIUM HELLOLHELLO is HELLOL thewordword is thewordword I need to know whether the word in the

Re: I need algorithm for my task

2014-11-05 Thread MRAB
On 2014-11-05 11:58, lordvita...@gmail.com wrote: I have line 'pythonpythonpyth'. How do I know which word is the foundation line?. Other examples: pythonpythonpyth is python DOLORIUMD is DOLORIUM HELLOLHELLO is HELLOL thewordword is thewordword I need to know whether the word in the text is

Re: I need algorithm for my task

2014-11-05 Thread C@rlos
I thing this work: stg='pythonpython' foundationline=stg[ 0:( stg [ 1: ].index( stg[ 0 ])+1 ) ] On 2014-11-05 11:58, lordvita...@gmail.com wrote: I have line 'pythonpythonpyth'. How do I know which word is the foundation line?. Other examples: pythonpythonpyth is python DOLORIUMD is

Re: I need algorithm for my task

2014-11-05 Thread MRAB
On 2014-11-05 18:05, C@rlos wrote: I thing this work: stg='pythonpython' foundationline=stg[ 0:( stg [ 1: ].index( stg[ 0 ])+1 ) ] It doesn't work for the final example or barbaz. -- https://mail.python.org/mailman/listinfo/python-list

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
On Wed, 05 Nov 2014 18:49:01 +, MRAB wrote: On 2014-11-05 18:05, C@rlos wrote: I thing this work: stg='pythonpython' foundationline=stg[ 0:( stg [ 1: ].index( stg[ 0 ])+1 ) ] It doesn't work for the final example or barbaz. I have two algorithms I've implemented. Still not sure

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
On Wed, 05 Nov 2014 18:49:01 +, MRAB wrote: It doesn't work for the final example or barbaz. Oh, and we really need a private python homework answers list where we can discuss the most pythonic solution we can think of for all these homework / coursework questions without showing the

Re: I need algorithm for my task

2014-11-05 Thread Chris Angelico
On Thu, Nov 6, 2014 at 2:36 PM, Denis McMahon denismfmcma...@gmail.com wrote: On Wed, 05 Nov 2014 18:49:01 +, MRAB wrote: It doesn't work for the final example or barbaz. Oh, and we really need a private python homework answers list where we can discuss the most pythonic solution we can

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
On Thu, 06 Nov 2014 03:36:40 +, Denis McMahon wrote: On Wed, 05 Nov 2014 18:49:01 +, MRAB wrote: It doesn't work for the final example or barbaz. Oh, and we really need a private python homework answers list where we can discuss the most pythonic solution we can think of for all

Re: I need algorithm for my task

2014-11-05 Thread Chris Angelico
On Thu, Nov 6, 2014 at 3:00 PM, Denis McMahon denismfmcma...@gmail.com wrote: def baseword(s): find shortest sequence which repeats to generate s return s[0:[.join([s[0:x]for k in range(int(len(s)/x)+1)])[0:len (s)]for x in range(1,len(s)+1)].index(s)+1] That's hardly a PEP-8

Re: I need algorithm for my task

2014-11-05 Thread Denis McMahon
On Thu, 06 Nov 2014 15:14:05 +1100, Chris Angelico wrote: On Thu, Nov 6, 2014 at 3:00 PM, Denis McMahon denismfmcma...@gmail.com wrote: def baseword(s): find shortest sequence which repeats to generate s return s[0:[.join([s[0:x]for k in range(int(len(s)/x)+1)])[0:len (s)]for x in