[Tutor] how to compare elements of 2 lists

Kent Johnson kent37 at tds.net
Wed Dec 26 15:51:45 CET 2007


Chris Fuller wrote:
> I didn't think of that.  But for an arbitrary 2D list, you need the asterisk 
> syntax.

I don't know what you mean by "an arbitrary 2D list". You need the * 
syntax when your arguments are *already* in a list. For any number of 
arguments,
   zip(*[a, b, ..., x, y, z])
can be written more simple as
   zip(a, b, ..., x, y, z)

Kent

> 
> On Tuesday 25 December 2007 19:00, you wrote:
>> Chris Fuller wrote:
>>>>>> zip(*[a,b])
>>> [(4, 8), (3, 6), (2, 3), (6, 3), (7, 2), (9, 7)]
>> This can be just zip(a, b)
>>
>> Kent
> 



More information about the Tutor mailing list