human
Find iâ €™ th index character in a binary string obtained after n iterations | Set 2 | Function to find the i - th character.
distance between two consecutive elements after N iterations.
binary representation of M.
kth digit will be derived from root for sure.
Check whether there is need to flip root or not.
Driver Code"
How can the above be solved in Python?

=====
Write me a code to find iâ €™ th index character in a binary string obtained after n iterations and the other steps required?
assistant
#Here is code to find iâ €™ th index character in a binary string obtained after n iterations and the other steps required.
 def KthCharacter ( m , n , k ) :
	distance = pow ( 2 , n )
	Block_number = int ( k / distance )
	remaining = k % distance
	s = [ 0 ] * 32
	x = 0
	while ( m > 0 ) :
		s [ x ] = m % 2
		m = int ( m / 2 )
		x += 1
	root = s [ x - 1 - Block_number ]
	if ( remaining == 0 ) :
		print ( root )
		return
	flip = True
	while ( remaining > 1 ) :
		if ( remaining & 1 ) :
			flip = not ( flip )
		remaining = remaining >> 1
	if ( flip ) :
		print ( not ( root ) )
	else :
		print ( root )
m = 5
k = 5
n = 3
KthCharacter ( m , n , k )