apply boolean to list

Solutions on MaxInterview for apply boolean to list by the best coders in the world

showing results for - "apply boolean to list"
Darius
02 Feb 2020
1>>> from itertools import compress
2>>> list_a = [1, 2, 4, 6]
3>>> fil = [True, False, True, False]
4>>> list(compress(list_a, fil))
5[1, 4]