human
Count all prefixes of the given binary array which are divisible by x | Function to return the count of total binary prefix which are divisible by x.
Initialize with zero.
Instead of converting all prefixes to decimal , take reminder with x.
If number is divisible by x then reminder = 0.
Driver code"
How can the above be solved in Python?

=====
Write me a code to count all prefixes of the given binary array which are divisible by x and the other steps required?
assistant
#Here is code to count all prefixes of the given binary array which are divisible by x and the other steps required.
 def CntDivbyX ( arr , n , x ) :
	number = 0
	count = 0
	for i in range ( 0 , n ) :
		number = ( number * 2 + arr [ i ] ) % x
		if number == 0 :
			count += 1
	return count
arr = [ 1 , 0 , 1 , 0 , 1 , 1 , 0 ]
n = 7
x = 2
print ( CntDivbyX ( arr , n , x ) )