Re: Splitting of string at an interval

2013-04-08 Thread Dave Angel
On 04/08/2013 10:38 PM, Steven D'Aprano wrote: On Mon, 08 Apr 2013 21:09:08 -0400, Roy Smith wrote: There's a whole competition about writing the smallest program which outputs the song "99 bottles of beer": http://codegolf.com/99-bottles-of-beer I see the top 10 entries are all written in P

Re: Splitting of string at an interval

2013-04-08 Thread Chris Angelico
On Tue, Apr 9, 2013 at 12:38 PM, Steven D'Aprano wrote: > On Mon, 08 Apr 2013 21:09:08 -0400, Roy Smith wrote: > >>> There's a whole competition about writing the smallest program which >>> outputs the song "99 bottles of beer": >>> >>> http://codegolf.com/99-bottles-of-beer >> >> I see the top 10

Re: Splitting of string at an interval

2013-04-08 Thread Andrew Berg
On 2013.04.08 21:38, Steven D'Aprano wrote: > In fact, I may make it a bare . so that not only will it be the shortest > program, but also the smallest program in terms of number of non-white > pixels. Until someone implements it in Whitespace. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.

Re: Splitting of string at an interval

2013-04-08 Thread Steven D'Aprano
On Mon, 08 Apr 2013 21:09:08 -0400, Roy Smith wrote: >> There's a whole competition about writing the smallest program which >> outputs the song "99 bottles of beer": >> >> http://codegolf.com/99-bottles-of-beer > > I see the top 10 entries are all written in Perl. I suppose this says > somethi

Re: Splitting of string at an interval

2013-04-08 Thread Tim Chase
On 2013-04-08 21:09, Roy Smith wrote: >> http://codegolf.com/99-bottles-of-beer > > I see the top 10 entries are all written in Perl. I suppose this > says something. About the capabilities of Perl for writing such code, or about the drinking habits of Perl programmers? :-) Or-about-how-perl-dr

Re: Splitting of string at an interval

2013-04-08 Thread Roy Smith
In article , Arnaud Delobelle wrote: > On 8 April 2013 17:20, Chris Angelico wrote: > > On Tue, Apr 9, 2013 at 1:37 AM, Roy Smith wrote: > >> I can't help point out, however, that if your initial implementation is to > >> have your code return a constant, it's pretty likely to be an optimum

Re: Splitting of string at an interval

2013-04-08 Thread Arnaud Delobelle
On 8 April 2013 17:20, Chris Angelico wrote: > On Tue, Apr 9, 2013 at 1:37 AM, Roy Smith wrote: >> I can't help point out, however, that if your initial implementation is to >> have your code return a constant, it's pretty likely to be an optimum >> solution in both time and space :-) > > Likel

Re: Splitting of string at an interval

2013-04-08 Thread Chris Angelico
On Tue, Apr 9, 2013 at 1:37 AM, Roy Smith wrote: > I can't help point out, however, that if your initial implementation is to > have your code return a constant, it's pretty likely to be an optimum > solution in both time and space :-) Likely, but not certain. # 1 def fifty_stars(): return "

Re: Splitting of string at an interval

2013-04-08 Thread Roy Smith
On Apr 8, 2013, at 11:10 AM, Arnaud Delobelle wrote: > On 8 April 2013 14:21, Roy Smith wrote: > >> For a while, I was rabidly(*) into TDD (Test Driven Development). The >> cycle I was using was, "Write a specification of a behavior, write a >> (failing) test for that behavior, then write the

Re: Splitting of string at an interval

2013-04-08 Thread Arnaud Delobelle
On 8 April 2013 14:21, Roy Smith wrote: > For a while, I was rabidly(*) into TDD (Test Driven Development). The > cycle I was using was, "Write a specification of a behavior, write a > (failing) test for that behavior, then write the least possible amount > of code to make the test pass. Lather

Re: Splitting of string at an interval

2013-04-08 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Apr 8, 2013 at 7:48 AM, Steven D'Aprano > wrote: > > Like every programming problem, the solution is to break it apart into > > small, simple steps that even a computer can follow. > > ... > > 5) Shortcut the whole thing, since the problem was under

Re: Splitting of string at an interval

2013-04-07 Thread Chris Angelico
On Mon, Apr 8, 2013 at 7:48 AM, Steven D'Aprano wrote: > Like every programming problem, the solution is to break it apart into > small, simple steps that even a computer can follow. > ... 5) Shortcut the whole thing, since the problem was underspecified, by using a literal. words = ["The Sun",

Re: Splitting of string at an interval

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 13:25:57 -0700, subhabangalore wrote: > Dear Group, > > I was looking to split a string in a particular interval, like, > > If I have a string, > string="The Sun rises in the east of our earth" > > I like to see it as, > words=["The Sun","rises in","in the","east of","our e

Re: Splitting of string at an interval

2013-04-07 Thread Dave Angel
On 04/07/2013 04:25 PM, subhabangal...@gmail.com wrote: Dear Group, I was looking to split a string in a particular interval, like, If I have a string, string="The Sun rises in the east of our earth" Are you asserting that there is nothing but letters and whitespace in the string, and that

Splitting of string at an interval

2013-04-07 Thread subhabangalore
Dear Group, I was looking to split a string in a particular interval, like, If I have a string, string="The Sun rises in the east of our earth" I like to see it as, words=["The Sun","rises in","in the","east of","our earth"] If any one of the learned members can kindly suggest. Regards, Sub