There is no !
-like prefix operator for booleans in Python, for this we use not
.
>>> not True
False
>>> not False
True
>>> not 1
False
>>> not 0
True
There is a prefix (unary) bitwise not, ~
, but since Python's integers are signed integers that grow in size instead of rolling over, it's harder to demonstrate it.
>>> ~0b00000001
-2
But you can see it if you use a mask of all ones (for the number of bits in your integer) and format it correctly:
>>> f'{~(-2) & 0b11111111:08b}'
'00000001'
>>> f'{~(~(-2)) & 0b11111111:08b}'
'11111110'
This is generally only useful for bitwise operations, though.