8. A BIT of This OR That has bug

  1. A BIT of This OR That asks to print result of (0b1110 | 0b101 ) which is equivalent to 0b1111

i.e. 15 in decimal but python interpreter is giving pop up(

Oops, try again.
It looks like the value you printed isn't correct.

does others also facing same problem.. seem similar issue is with 9. This XOR That?


Sorry I only did the JS version of The Introduction to Bitwise Operators, but I believe it's pretty much the same thing.


This is not correct, I believe, because you did not put the same about of binaries in there.
There are 1-bits, 2-bits, 4-bits, and 8-bits in these. But in one of them, you have only put until 4-bits, which does not match. Putting another 0 at the front would make it work.


This would be the correct way to make it equal 0b1111, or even:


There are lots of combinations of this, but the one requirement in this is that you have to have a 1 in the 2-bit.

I say that there isn't a bug because there is an error, in your code, and I suggest you think about the XOR part later. :smiley:



The SCT is expecting a binary string:

print bin(0b1111 | 0b101)     #  0b1111


Thanks mtf, i was missing the bin() call.