human
Generate a Binary String without any consecutive 0 ' s ▁ and ▁ at ▁ most ▁ K ▁ consecutive ▁ 1' s | Function to construct the binary string.
Conditions when string construction is not possible.
Stores maximum 1 's that  can be placed in between.
Place 0 's.
Place 1 's in between.
Count remaining M 's.
Place 1 's at the end.
Place 1 's at the beginning.
Return the final string.
Driver Code"
How can the above be solved in Python?
 Write me a code to generate a Binary String without any consecutive 0 ' s ▁ and ▁ at ▁ most ▁ K ▁ consecutive ▁ 1' s and the other steps required?
assistant
#Here is code to generate a Binary String without any consecutive 0 ' s ▁ and ▁ at ▁ most ▁ K ▁ consecutive ▁ 1' s and the other steps required.
 def ConstructBinaryString ( N , M , K ) :
	if ( M < ( N - 1 ) or M > K * ( N + 1 ) ) :
		return ' - 1'
	ans = " "
	l = min ( K , M // ( N - 1 ) )
	temp = N
	while ( temp ) :
		temp -= 1
		ans += '0'
		if ( temp == 0 ) :
			break
		for i in range ( l ) :
			ans += '1'
	M -= ( N - 1 ) * l
	if ( M == 0 ) :
		return ans
	l = min ( M , K )
	for i in range ( l ) :
		ans += '1'
	M -= l
	while ( M > 0 ) :
		ans = '1' + ans
		M -= 1
	return ans
if __name__ == ' _ _ main _ _ ' :
	N = 5
	M = 9
	K = 2
	print ( ConstructBinaryString ( N , M , K ) )