My understanding was that ~
inverts all bits on the value specified.
the binary representation of 10
is 00001010
.
If I invert all the bits I get 11110101 = 235
.
Why is -11
displayed? Where am I going wrong?
a = 10
print(a)
print(~a)
# Output -11