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

2005-06-17 Thread Kent Johnson
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,

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

2005-06-17 Thread Chad Crabtree
Kent Johnson wrote: >Olli Rajala wrote: > > >>Hi again, >> >>I have a '2D array', I mean a list inside a list ([[][],[][],...]) and >>would need to check if the value exists in it. Of course I could do a >>for loop, but that just seem to be a little overkill, so is there any >>other way to do it

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

2005-06-17 Thread Kent Johnson
Olli Rajala wrote: > Hi again, > > I have a '2D array', I mean a list inside a list ([[][],[][],...]) and > would need to check if the value exists in it. Of course I could do a > for loop, but that just seem to be a little overkill, so is there any > other way to do it? I have to check the first

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

2005-06-16 Thread Olli Rajala
Hi again, I have a '2D array', I mean a list inside a list ([[][],[][],...]) and would need to check if the value exists in it. Of course I could do a for loop, but that just seem to be a little overkill, so is there any other way to do it? I have to check the first cell of every insider list. He