13. Just Flip Out


Hello everyone!!It's my first time to ask question,I just can not understand what my mistake is.........could you please tell me????


your mask has to be all "1"s to flip each bit in your variable.
because you included a "0" on the 5th position in your mask, the "0" on the fifth position in your variable is not flipped.

Here is what I did:

a = 0b11101110
print bin(a ^ 255)

(255 is 11111111 in binary)


Thank you man!!!!!:grin: