11/14 done completed code

What is wrong here?

def check_bit4(input):
    newIn = input
    mask = 0b01000
    desired = newIn & mask
    if desired > 0:
        return "on"
    else:
        return "off"

found out what was wrong fixed code above

1 Like

Why are you shifting the input?

def check_bit4(input):
if input > 0b111:
return β€œon”
else:
return β€œoff”

try this code. this worked for me

really works 
def check_bit4(input):
    check = 0b1000
    if input & check > 0:
        return "on"
    else:
        return "off"
1 Like