human
Write me a code to number of 0 s and 1 s at prime positions in the given array and the other steps required given the following:
Number of 0 s and 1 s at prime positions in the given array | Function that returns true if n is prime.
Check from 2 to n.
Function to find the count of 0 s and 1 s at prime indices.
To store the count of 0 s and 1 s.
If current 0 is at prime position.
If current 1 is at prime position.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to number of 0 s and 1 s at prime positions in the given array and the other steps required.
 def isPrime ( n ) :
	if ( n <= 1 ) :
		return False ;
	for i in range ( 2 , n ) :
		if ( n % i == 0 ) :
			return False ;
	return True ;
def countPrimePosition ( arr ) :
	c0 = 0 ; c1 = 0 ;
	n = len ( arr ) ;
	for i in range ( n ) :
		if ( arr [ i ] == 0 and isPrime ( i ) ) :
			c0 += 1 ;
		if ( arr [ i ] == 1 and isPrime ( i ) ) :
			c1 += 1 ;
	print ( " Number ▁ of ▁ 0s ▁ = " , c0 ) ;
	print ( " Number ▁ of ▁ 1s ▁ = " , c1 ) ;
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 0 , 1 , 0 , 1 ] ;
	countPrimePosition ( arr ) ;