Need a strange sort method...

Paul Rubin http
Mon Oct 16 16:30:46 EDT 2006


"SpreadTooThin" <bjobrien62 at gmail.com> writes:
> > I have one extra 10 that I shouldn't...
> 
> I think my loop termination is incorrect...

It looks wrong to me; try your loop on range(20) and see what happens.

> maybe I should just stop when my new series size is the same size as
> the original?

You should make exactly 3 passes.  You might also want to use
list.extend rather than adding lists.  Finally, your function modifies
its input list (by sorting it), which generally is not nice unless the
caller expects it and wants it.  You can save the caller some trouble
by making a sorted copy to work from.



More information about the Python-list mailing list