human
Turn off the rightmost set bit | Set 2 | Unsets the rightmost set bit of n and returns the result.
Checking whether bit position is set or not.
If bit position is found set , we flip this bit by xoring given number and number with bit position set.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to turn off the rightmost set bit and the other steps required.
 def FlipBits ( n ) :
	for bit in range ( 32 ) :
		if ( ( n >> bit ) & 1 ) :
			n = n ^ ( 1 << bit )
			break
	print ( " The ▁ number ▁ after ▁ unsetting ▁ the " , end = " ▁ " )
	print ( " rightmost ▁ set ▁ bit " , n )
if __name__ == ' _ _ main _ _ ' :
	N = 12 ;
	FlipBits ( N )