Re: this is simple...

2008-06-27 Thread Daniel da Silva
ToshiBoy, You might want to take a look at the filter() function, it can also be used for the kind of the thing you're doing. http://docs.python.org/tut/node7.html#SECTION00713 >>> B = range(1,27) >>> def test(b): ... if b*b in B: ... return True ... else: ...

Re: this is simple...

2008-06-27 Thread ToshiBoy
On Jun 28, 2:48 pm, Mel <[EMAIL PROTECTED]> wrote: > ToshiBoy wrote: > > I have two lists A and B that are both defined as range(1,27) I want > > to find the entries that are valid for A = BxB > [ ... ] > > I get, as expected 1,4,9,16,25 printed out being the only members of B > > where the conditi

Re: this is simple...

2008-06-27 Thread Mel
ToshiBoy wrote: > I have two lists A and B that are both defined as range(1,27) I want > to find the entries that are valid for A = BxB [ ... ] > I get, as expected 1,4,9,16,25 printed out being the only members of B > where the condition is true, but when I print B I get: > > [1, 2, 3, 4, 5, 7, 9

Re: this is simple...

2008-06-27 Thread Maric Michaud
Le Saturday 28 June 2008 06:30:25 ToshiBoy, vous avez écrit : > I am a newbie... and the first to admit it... but this has me stuffed: > > I have two lists A and B that are both defined as range(1,27) I want > to find the entries that are valid for A = BxB > > so here is my code: > > A = range(1,27

this is simple...

2008-06-27 Thread ToshiBoy
I am a newbie... and the first to admit it... but this has me stuffed: I have two lists A and B that are both defined as range(1,27) I want to find the entries that are valid for A = BxB so here is my code: A = range(1,27) B = range(1,27) for b in B: if b*b in A: print b