With string abcdefg and list [1, 1, 0, 0, 1, 1, 0], what is a Pythonic way to return all characters in the string that match 1 (on) in the list?
The desired output will be:
['a', 'b', 'e', 'f']
Thanks!
Edit:
One more question, is it possible to group ab and ef so that the output will look something like this: ['ab', 'ef']? Basically the idea is to group characters that are separated by 0. If no 0 then it'll be ['abcdefg']. Thanks!