Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.advocacy > #375321

Re: Ping sbd: another programming challenge for your developmentally challenged children

From "Octavian W. Lagrange" <olagrang@perch.invalid>
Newsgroups comp.os.linux.advocacy
Subject Re: Ping sbd: another programming challenge for your developmentally challenged children
Date 2016-10-06 21:25 +0000
Organization O.W.L.
Message-ID <hjsgue03agu3.ki@perch.invalid> (permalink)
References <nt5rdf$35m$2@dont-email.me>

Show all headers | View raw


DFS <nospam@dfs.com> wrote:
> And it's another 12-line python program!  How about that?!
> 
> Same as before, the challenge is to replicate the functionality in 
> another programming language.
> 
> Even though it's a tiny bit of code, I know all 3 of y'all will whine a 
> LOT, so this time I'll give you more hints.
> 
> --------------------------------------------------------
> def splitByLength(t,n,m):
>        w=str(t).split()
>        s,q=0,''
>        if w[0][0]=='>':
>                q=w[0]+' '
>                w.pop(0)
>        for e in range(1,len(w)-1):
>                if w[e][-1:]=='.':w[e]+=' '
>                if len(q)+len(' '.join(w[s:e+1]))>=m:
>                         print n,q+' '.join(w[s:e])
>                         n+=1; s=e
>        print n,q+' '.join(w[s:len(w)])
> --------------------------------------------------------
> 
> t = input text
> n = starting number
> m = max length of lines
> w = list object
> s = integer to keep track of position
> q = quoter character >
> e = integer to keep track of position
> 
> 
> 
> Example input:
> 
> txt = "> Intel doesn't have to write a kernel from scratch. Nor does 
> Android.  They can use Linux. And if they need to make modifications for 
> their own benefit, that's fine, just share that back. They benefited by 
> not having to develop from scratch. But they need to give something back 
> in return.  Like the work they added. Both parties are give and take 
> something from each other. I'll take that over the BSD license any day 
> of the week."
> 
> 
> Output of splitByLength(txt,1,60):
> 
> 1 > Intel doesn't have to write a kernel from scratch.  Nor
> 2 > does Android.  They can use Linux.  And if they need to
> 3 > make modifications for their own benefit, that's fine,
> 4 > just share that back.  They benefited by not having to
> 5 > develop from scratch.  But they need to give something
> 6 > back in return.  Like the work they added.  Both parties
> 7 > are give and take something from each other.  I'll take
> 8 > that over the BSD license any day of the week.
> 
> 
> Output of splitByLength(txt,100,40):
> 
> 100 > Intel doesn't have to write a kernel
> 101 > from scratch.  Nor does Android.
> 102 > They can use Linux.  And if they need
> 103 > to make modifications for their own
> 104 > benefit, that's fine, just share that
> 105 > back.  They benefited by not having
> 106 > to develop from scratch.  But they
> 107 > need to give something back in
> 108 > return.  Like the work they added.
> 109 > Both parties are give and take
> 110 > something from each other.  I'll take
> 111 > that over the BSD license any day of
> 112 > the week.
> 
> 
> 
> 
> 
> Now wake those little dummies of yours and tell them there's work to do!
> 

4 line bash function.  12 line complete program.

Back to comp.os.linux.advocacy | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-06 11:42 -0400
  Re: Ping sbd: another programming challenge for your developmentally challenged children Adlbifhr Mjduhgfks <am@random.us> - 2016-10-06 20:00 +0000
    Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-06 19:31 -0400
      Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-07 00:20 +0000
        Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-06 20:55 -0400
          Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-07 01:04 +0000
            Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-06 22:11 -0400
              Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-07 02:19 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-06 23:20 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-07 03:33 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-07 00:02 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-07 04:22 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children fr314159@gmail.com - 2016-10-07 08:08 -0700
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-07 10:42 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-08 03:13 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-08 03:19 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-10-08 05:37 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-10 07:09 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children Melzzzzz <mel@zzzzz.com> - 2016-10-10 14:11 +0200
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-10 07:37 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-10 16:56 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Silver Slimer <.m@nsn.s> - 2016-10-08 10:26 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-08 10:48 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children Steve Carroll <fretwizzer@gmail.com> - 2016-10-08 07:58 -0700
                Re: Ping sbd: another programming challenge for your developmentally challenged children Silver Slimer <.m@nsn.s> - 2016-10-08 15:04 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-09 10:24 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-08 15:28 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-10-08 15:41 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-08 19:57 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Silver Slimer <.m@nsn.s> - 2016-10-08 17:23 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children Silver Slimer <.m@nsn.s> - 2016-10-08 10:24 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-08 10:44 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-08 17:11 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-08 13:46 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-08 20:01 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children ronb <ronb02NOSPAM@gmail.com> - 2016-10-08 23:23 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-10-08 20:43 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-09 01:15 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-09 01:13 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children ronb <ronb02NOSPAM@gmail.com> - 2016-10-09 02:08 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-09 02:13 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-10-09 08:15 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-10 07:27 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children ronb <ronb02NOSPAM@gmail.com> - 2016-10-08 23:22 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-08 22:54 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-09 15:13 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-10-09 18:14 +0200
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-09 16:19 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-10-09 18:25 +0200
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-10 07:21 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-10 10:50 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children Snit <usenet@gallopinginsanity.com> - 2016-11-01 10:09 -0700
                Re: Ping sbd: another programming challenge for your developmentally challenged children William Poaster <wp@dev.null> - 2016-10-09 22:29 +0100
                Re: Ping sbd: another programming challenge for your developmentally challenged children Marek Novotny <marek.novotny@marspolar.com> - 2016-10-09 13:38 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-09 23:58 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-10 07:29 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children William Poaster <wp@dev.null> - 2016-10-10 13:41 +0100
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-10 12:25 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-10 13:33 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-10 10:51 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children chrisv <chrisv@nospam.invalid> - 2016-10-10 12:45 -0500
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-10 16:35 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children Silver Slimer <.m@nsn.s> - 2016-10-10 18:54 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-10 21:56 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-10 22:48 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Jim Polaski <jpolaski@linuxmail.org> - 2016-10-11 00:02 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-10 21:58 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children GreyCloud <Cumulus@mist.com> - 2016-10-10 21:58 -0600
                Re: Ping sbd: another programming challenge for your developmentally challenged children Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-10-07 17:56 +0200
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-07 13:25 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children Adlbifhr Mjduhgfks <am@random.us> - 2016-10-08 00:12 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-08 10:40 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-10 13:34 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-07 04:15 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Sandman <mr@sandman.net> - 2016-10-07 16:37 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-10-07 20:34 +0200
          Re: Ping sbd: another programming challenge for your developmentally challenged children Steve Carroll <frelwizzen@gmail.com> - 2016-10-07 11:10 -0700
    Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-20 11:20 -0400
      Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-21 08:53 +0000
        Re: Ping sbd: another programming challenge for your developmentally challenged children Melzzzzz <mel@zzzzz.com> - 2016-10-21 13:19 +0200
        Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-21 10:45 -0400
          Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-22 01:06 +0000
            Re: Ping sbd: another programming challenge for your developmentally challenged children Melzzzzz <Melzzzzz@zzzzz.com> - 2016-10-22 02:15 +0000
              Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-22 02:40 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Melzzzzz <mel@zzzzz.com> - 2016-10-22 05:00 +0200
                Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-22 16:34 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Melzzzzz <mel@zzzzz.com> - 2016-10-22 23:14 +0200
                Re: Ping sbd: another programming challenge for your developmentally challenged children Chris Ahlstrom <OFeem1987@teleworm.us> - 2016-10-22 18:24 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-25 23:20 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-26 05:22 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-26 11:26 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-26 20:42 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children Melzzzzz <mel@zzzzz.com> - 2016-10-27 01:45 +0200
                Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-27 01:21 +0000
            Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-22 09:33 -0400
              Re: Ping sbd: another programming challenge for your developmentally challenged children deplorable owl <owl@rooftop.invalid> - 2016-10-22 16:50 +0000
  Re: Ping sbd: another programming challenge for your developmentally challenged children "Octavian W. Lagrange" <olagrang@perch.invalid> - 2016-10-06 21:25 +0000
  Re: Ping sbd: another programming challenge for your developmentally challenged children Sandman <mr@sandman.net> - 2016-10-07 16:30 +0000
    Re: Ping sbd: another programming challenge for your developmentally challenged children Steve Carroll <fretwizzer@gmail.com> - 2016-10-07 09:44 -0700
      Re: Ping sbd: another programming challenge for your developmentally challenged children Sandman <mr@sandman.net> - 2016-10-07 17:20 +0000
        Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-07 15:24 -0400
          Re: Ping sbd: another programming challenge for your developmentally challenged children Sandman <mr@sandman.net> - 2016-10-07 20:01 +0000
            Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-07 16:50 -0400
              Re: Ping sbd: another programming challenge for your developmentally challenged children Sandman <mr@sandman.net> - 2016-10-07 21:37 +0000
                Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-07 17:54 -0400
                Re: Ping sbd: another programming challenge for your developmentally challenged children Sandman <mr@sandman.net> - 2016-10-07 22:11 +0000
    Re: Ping sbd: another programming challenge for your developmentally challenged children DFS <nospam@dfs.com> - 2016-10-07 13:51 -0400
      Re: Ping sbd: another programming challenge for your developmentally challenged children Sandman <mr@sandman.net> - 2016-10-07 18:13 +0000
  Re: Ping sbd: another programming challenge for your developmentally challenged children Steve Carroll <frelwizzen@gmail.com> - 2016-10-07 11:10 -0700

csiph-web