human
Smallest number exceeding N whose Kth bit is set | Function to find the number greater than n whose Kth bit is set.
Iterate from N + 1.
Check if Kth bit is set or not.
Increment M for next number.
Return the minimum value.
Driver Code.
Given N and K.
Function Call"
How can the above be solved in Python?
 Write me a code to smallest number exceeding N whose Kth bit is set and the other steps required?
assistant
#Here is code to smallest number exceeding N whose Kth bit is set and the other steps required.
 def find_next ( n , k ) :
	M = n + 1 ;
	while ( True ) :
		if ( ( M & ( 1 << k ) ) > 0 ) :
			break ;
		M += 1 ;
	return M ;
if __name__ == ' _ _ main _ _ ' :
	N = 15 ; K = 2 ;
	print ( find_next ( N , K ) ) ;