11: The Man Behind The Bit Mask


#1


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".


Can I get some help here? :confounded:


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)


#2

The above does not look like an XOR operation.


#3

Im not sure what im supposed to change :frowning:


#4

What operator should we use in an XOR expression?


#5

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


#6

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