The Python Oracle

How do I get the opposite (negation) of a Boolean in Python?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Mysterious Puzzle

--

Chapters
00:00 Question
00:30 Accepted answer (Score 300)
00:57 Answer 2 (Score 98)
05:31 Answer 3 (Score 11)
05:46 Answer 4 (Score 6)
06:42 Thank you

--

Full question
https://stackoverflow.com/questions/7030...

Accepted answer links:
[not]: https://docs.python.org/3/reference/expr...
[operator precedence rules]: https://docs.python.org/3/reference/expr...
[a is not b]: https://docs.python.org/3/reference/expr...
[a not in b]: https://docs.python.org/3/reference/expr...

Answer 2 links:
[not]: https://docs.python.org/reference/expres...
[operator]: https://docs.python.org/library/operator...
[operator.not_]: https://docs.python.org/library/operator...
[operator.__not__]: https://docs.python.org/library/operator...
[map]: https://docs.python.org/library/function...
[filter]: https://docs.python.org/library/function...
[operator.inv]: https://docs.python.org/library/operator...
[truth value]: https://docs.python.org/library/stdtypes...
[__bool__]: https://docs.python.org/reference/datamo...
[__nonzero__]: https://docs.python.org/2/reference/data...
[__invert__]: https://docs.python.org/reference/datamo...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #boolean

#avk47