[Tutor] Checking if value exist in a '2D array'

Kent Johnson kent37 at tds.net
Fri Jun 17 16:50:08 CEST 2005


Chad Crabtree wrote:
> The second case you show should be true because I believe that's what
> he
> asked for.  Here is I believe the correct way to do this.
> 
> 
>>>>l= [ [1], [2,3], [4,5], [6]]
>>>>def isin(test,alist):
> 
> ...     return bool([x for x in alist if test in x])

I don't think so, the OP says "I have to check the first cell of every insider
list."

Kent



More information about the Tutor mailing list