Print ' K ' th least significant bit of a number | Function returns 1 if set , 0 if not ; Driver code ; Function call
def LSB ( num , K ) : NEW_LINE INDENT return bool ( num & ( 1 << ( K - 1 ) ) ) NEW_LINE DEDENT num , k = 10 , 4 NEW_LINE res = LSB ( num , k ) NEW_LINE if res : NEW_LINE INDENT print 1 NEW_LINE DEDENT else : NEW_LINE INDENT print 0 NEW_LINE DEDENT