B
barberomarcelo
Let's say I have two lists:
a = [0, 1, 0, 1, 1, 0]
b = [2, 4, 6, 8, 10, 12]
I want a list comprehension that has the elements in b where a[element]
== 1.
That's to say, in the example above, the result must be: [4, 8, 10]
Any hints?
Marcelo
a = [0, 1, 0, 1, 1, 0]
b = [2, 4, 6, 8, 10, 12]
I want a list comprehension that has the elements in b where a[element]
== 1.
That's to say, in the example above, the result must be: [4, 8, 10]
Any hints?
Marcelo