human
Represent a number N in base | Function to convert N to equivalent representation in base - 2.
Stores the required answer.
Iterate until N is not equal to zero.
If N is Even.
Add char '0' in front of string.
Add char '1' in front of string.
Decrement N by 1.
Divide N by - 2.
If string is empty , that means N is zero.
Put '0' in string s.
Given Input.
Function Call"
How can the above be solved in Python?

What is a code to represent a number N in base and the other steps required?
assistant
#Here is code to represent a number N in base and the other steps required.
 def BaseConversion ( N ) :
	s = " "
	while ( N != 0 ) :
		if ( N % 2 == 0 ) :
			s = "0" + s
		else :
			s = "1" + s
			N -= 1
		N /= - 2
	if ( s == " " ) :
		s = "0"
	return s
N = - 9
print ( BaseConversion ( N ) )