"Luke Paireepinart" <[EMAIL PROTECTED]> wrote
> The first thing that occurred to me was just to use a modulus to
> index
> into the second, shorter list.
That was the first thing that occured to me too but when
I tried it I couldn't get it to work...
> >>> l = [1,2,3,4,5]
> >>> t = ('r','g','b')
> >>> for i in range(len(l)):
> print (l[i], t[i%len(t)])
because I was trying t[len(t) % i]
and various variations, I never thought of reversing the arguments!"
I knew a modulus trick existed but couldn't figure it out this
morning.
I hadn't had coffee yet, at least that's my excuse! :-)
Alan G.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor