Task: It should check to see if the fourth bit from the right is on.
def check_bit4(input): mask=0b1000 cresult=input & mask if cresult > 0 : return "on" else: return "off"
This code above works, but initially I had it set to
if cresult == 1
and it fails. Why is it that it works with bigger than, but not with equals to?