Re: question about a program

2010-10-08 Thread Steven D'Aprano
On Thu, 07 Oct 2010 17:39:51 -0700, Logan Butler wrote: > question about an assignment: > places("home sweet home is here",' ') > [4, 10, 15, 18] > > this is my code: > > def places(x, y): > return [x.index(y) for v in x if (v == y)] > > so far I'm only getting > [4, 4, 4, 4] > > so

Re: question about a program

2010-10-08 Thread Andreas Waldenburger
On Fri, 8 Oct 2010 14:34:21 -0700 Chris Rebert wrote: > On Thu, Oct 7, 2010 at 5:39 PM, Logan Butler > wrote: > > question about an assignment: > > > places("home sweet home is here",' ') > > [4, 10, 15, 18] > > > > this is my code: > > > > def places(x, y): > >    return [x.index(y) for v

Re: question about a program

2010-10-08 Thread Chris Rebert
On Thu, Oct 7, 2010 at 5:39 PM, Logan Butler wrote: > question about an assignment: > places("home sweet home is here",' ') > [4, 10, 15, 18] > > this is my code: > > def places(x, y): >    return [x.index(y) for v in x if (v == y)] > > so far I'm only getting > [4, 4, 4, 4] > > so the first

Re: question about a program

2010-10-08 Thread Richard Thomas
On Oct 8, 1:39 am, Logan Butler wrote: > question about an assignment: > > >>> places("home sweet home is here",' ') > > [4, 10, 15, 18] > > this is my code: > > def places(x, y): >     return [x.index(y) for v in x if (v == y)] > > so far I'm only getting > [4, 4, 4, 4] > > so the first value is

Re: question about a program

2010-10-08 Thread Andreas Waldenburger
On Thu, 7 Oct 2010 17:39:51 -0700 (PDT) Logan Butler wrote: > question about an assignment: > > >>> places("home sweet home is here",' ') > [4, 10, 15, 18] > > this is my code: > > def places(x, y): > return [x.index(y) for v in x if (v == y)] > > so far I'm only getting > [4, 4, 4, 4] >

question about a program

2010-10-08 Thread Logan Butler
question about an assignment: >>> places("home sweet home is here",' ') [4, 10, 15, 18] this is my code: def places(x, y): return [x.index(y) for v in x if (v == y)] so far I'm only getting [4, 4, 4, 4] so the first value is correct, it is just not iterating on to the next three items it n