11: The Man Behind The Bit Mask

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

My code keeps getting a error that says : Oops, try again. Your function fails on check_bit4(0b0). It returns β€œon” when it should return β€œoff”.

<What do you expect to happen instead?>
Can I get some help here? :confounded:

```python

def check_bit4(input):
mask = 0b1000
desired = mask + input
if desired > 0:
return β€œon”
else:
return β€œoff”

print check_bit4(0b1000)
print check_bit4(0b1)

<do not remove the three backticks above>

The above does not look like an XOR operation.

1 Like

Im not sure what im supposed to change :frowning:

What operator should we use in an XOR expression?

OH!!! I got it ! Thank you!!!

1 Like

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