I have two lists: a = [10.0,20.0] and b = [1.0,10.0,15.0,20.0,30.0,100.0].
How can I remove from list b all the elements between 10.0 and 20.0? Here is what I tried:
c = [b[y] for y in range(len(b)) if (b[y] < a[0] or b[y] > a[1])]
I expect to get c = [1.0, 30.0, 100.0], but I get c = [1.0,10.0,15.0,20.0,30.0,100.0].
How can I exclude components from a list that are in a certain range by using only list comprehension?