Just flip out


i did the exercise correctly but i don´t get why if we´re using some bitwise operator on a 8 bit number, we get back a 5 bit number

In the editor is the 8 bit variable a. Use a bitmask and the value a in order to achieve a result where all of the bits in a are flipped. Be sure to print your answer as a bin() string!


a = 0b11101110

desired= a^mask

print bin(desired)



Hi @maverb,

In the result, 0b00010001, the three 0s immediately following the 0b prefix are superfluous, and are discarded, just as such leading 0s would be discarded from a result in a decimal arithmetic operation. Therefore, 0b00010001 is represented as 0b10001.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.