Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

check condition for a list of lists

I have a list of lists L = [L1, L2, L3,... Lm] where each Li is a list again. I want to check each Li for a condition.

I need only those Li where all elements of Li satisfy a certain property.

I am trying the following but it's not working the way I want.

for i in range(0, len(L)): U = L[i] for s in U: check(s) But this does not distinguish between the elements of Li.

A little help is needed.

Thanks

check condition for a list of lists

I have a list of lists L = [L1, L2, L3,... Lm] where each Li is a list again. I want to check each Li for a condition.

I need only those Li where all elements of Li satisfy a certain property.

I am trying the following but it's not working the way I want.

for i in range(0, len(L)):
     U = L[i]
     for s in U:
              check(s)check(s)

But this does not distinguish between the elements of Li.

A little help is needed.

Thanks