The Man Behind the Bit Mask


#1



The Man Behind the Bit Mask.


This the error I received.
Oops, try again. Your function fails on check_bit4(0b1000). It returns "'on" when it should return "on".
I'm not quite sure what is wrong, my code looks correct, and apprently it's returning what it is supposed to...


def check_bit4(input):
    num=0b1100
    mask=0b1000
    desired=num & mask
    if input >= desired:
        return "'on"
    else:
        return "off"


#2

Just kidding, I figured it out


#3

Hi, @arcsolver34323 ,

Check, carefully, what is inside the double-quote marks, here ...

return "'on"

EDIT: Ah, you found it :slight_smile:


#4

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