I start with the following list s
and bitmask b
:
s = ['baa', 'baa', 'black', 'sheep', 'have', 'you', 'any', 'wool']
b = [1, 0, 0, 0, 1, 1, 1, 0] # or any iterable with boolean values
How do I write some function apply_bitmask(s, b)
so that it returns
['baa', 'have', 'you', 'any']