On Sat, Oct 3, 2009 at 7:53 PM, skorpi...@gmail.com <skorpi...@gmail.com> wrote: > On Oct 3, 10:36 pm, Chris Rebert <c...@rebertia.com> wrote: <snip> >> Since this sounds like homework, I won't give actual code, but here's >> a gameplan: >> >> 1. Split the list into sublists based on where the runs of zeros stop and >> start. >> 2. Categorize the sublists and place them into lists-of-lists based on >> whether they have nonzero entries.
>> To do the categorization, you'll >> have to iterate over the original list and track how many previous 0s >> you've seen consecutively. Erm, s/categorization/splitting and move this sentence into point #1, obviously. Mea culpa. :) Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list