<br><br><div><span class="gmail_quote">On 6/18/07, <b class="gmail_sendername">Simon Hooper</b> <<a href="mailto:simon@partex.co.uk">simon@partex.co.uk</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Luke,<br><br>* On 17/06/07, Luke Paireepinart wrote:<br>> a more expanded version that accounts for either list being the longer<br>> one, or both being the same length, would be:<br>><br>> >>> if len(t) > len(l): x = len(t)
<br>> else: x = len(l)<br>> >>> print [(l[i%len(l)],t[i%len(t)]) for i in range(x)]<br>> [(1, 'r'), (2, 'g'), (3, 'b'), (4, 'r'), (5, 'g')]<br><br>Being the duffer that I am, I'm very pleased with myself that I came up
<br>with a similar solution (albeit as a function rather than a list<br>comprehension) :)<br><br>You do not need the if statement either,</blockquote><div><br>Yeah, I never knew about the max() function!<br>I noticed someone else used it in one of their solutions.
<br>I'm pretty sure I've seen it a lot before, just didn't remember it.<br>-Luke<br></div></div><br>