human
Can you provide a code to how to turn on a particular bit in a number given the following:
How to turn on a particular bit in a number ? | Returns a number that has all bits same as n except the k 'th bit which is made 1.
k must be greater than 0.
Do | of n with a number with all unset bits except the k 'th bit.
Driver program to test above function"
How can the above be solved in Python?
assistant
#Here is code to how to turn on a particular bit in a number .
 def turnOnK ( n , k ) :
	if ( k <= 0 ) :
		return n
	return ( n | ( 1 << ( k - 1 ) ) )
n = 4
k = 2
print ( turnOnK ( n , k ) )