#sample solution
def check_bit4(someInt):
#print someInt
#print bin(someInt)
#binEquivalent = bin(someInt)
#print binEquivalent
mask = 0b1000
#print bin(mask)
#binMask = bin(mask)
result = someInt & mask
#print result
#print bin(result)
if result >= 8:
return "on"
else:
return "off"
print check_bit4(8)
No comments:
Post a Comment