Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, December 2, 2012

Codecademy: The Man Behind the Bit Mask


#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


This is an example of scrolling text using Javascript.

Popular Posts