[Tutor] working with empty lists

Rance Hall ranceh at gmail.com
Thu Sep 16 14:46:44 CEST 2010

On Wed, Sep 15, 2010 at 11:33 PM, bob gailer <bgailer at gmail.com> wrote:
>  On 9/16/2010 12:05 AM, Rance Hall wrote:

Thanks guys for replying, looks like I do have a bug in my code, but
its not where I thought it was.  Must have been up too late last

The code I provided in my OP does work (with typos corrected) but this
code with one layer of complexity does not.

def paginate_stuff(list,start):
    pagesize = 2
    for i in list[start:start+pagesize]:
        print('%s. %s' % (i,list[i]))

l = []
for i in range(0,10):


Idea here is to be able to take N things Y at a time sequentially from
anywhere in the middle of the list.

every time I run this code I start the output one list item in the
sequence ahead of where I want to.

I can change the functional call to paginate_stuff(l,3)

and it will start where the above one leaves off

But I keep losing list[0]

Im reasonably sure that it has something to do with my for loop, but I
don't understand how

More information about the Tutor mailing list