<br><br><div><span class="gmail_quote">On 6/18/07, <b class="gmail_sendername">Simon Hooper</b> &lt;<a href="mailto:simon@partex.co.uk">simon@partex.co.uk</a>&gt; 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>&gt; a more expanded version that accounts for either list being the longer<br>&gt; one, or both being the same length, would be:<br>&gt;<br>&gt;&nbsp;&nbsp;&gt;&gt;&gt; if len(t) &gt; len(l): x = len(t)
<br>&gt; else: x = len(l)<br>&gt;&nbsp;&nbsp;&gt;&gt;&gt; print [(l[i%len(l)],t[i%len(t)]) for i in range(x)]<br>&gt; [(1, &#39;r&#39;), (2, &#39;g&#39;), (3, &#39;b&#39;), (4, &#39;r&#39;), (5, &#39;g&#39;)]<br><br>Being the duffer that I am, I&#39;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&#39;m pretty sure I&#39;ve seen it a lot before, just didn&#39;t remember it.<br>-Luke<br></div></div><br>