how to invert a true false array in python

Solutions on MaxInterview for how to invert a true false array in python by the best coders in the world

showing results for - "how to invert a true false array in python"
Evangelina
02 Mar 2020
1>>> import numpy
2>>> mylist = [True, True, False]
3>>> ~numpy.array(mylist)
4array([False, False, True], dtype=bool)
5>>> list(~numpy.array(mylist))
6[False, False, True]