Jan-27-2020, 07:14 AM
x = 4
y = 1
a = ~x
print(a)
Bit operation on 4 which equates to binary 100
what would be NOT operation on it?
I assumed that it would be binary 011 equating to decimal 3.
but the OpenEDG (edube.org) says the answer is decimal (-5) with no explanation.
Can someone throw a quick explanation as I didn't get its basics right probably.
y = 1
a = ~x
print(a)
Bit operation on 4 which equates to binary 100
what would be NOT operation on it?
I assumed that it would be binary 011 equating to decimal 3.
but the OpenEDG (edube.org) says the answer is decimal (-5) with no explanation.
Can someone throw a quick explanation as I didn't get its basics right probably.