wow,<br><br>very interesting thread this was..I probably learnt a lot from this than by flipping a few pages of a python text...<br><br>thank you all for your interesting responses .. <br><br>iyer<br><br><b><i>Luke Paireepinart <rabidpoobear@gmail.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> <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> _______________________________________________<br>Tutor maillist - Tutor@python.org<br>http://mail.python.org/mailman/listinfo/tutor<br></blockquote><br><p> 
<hr size=1>Need Mail bonding?<br>Go to the <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">Yahoo! Mail Q&A</a> for <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">great tips from Yahoo! Answers</a> users.