human
What is a code to count sub and the other steps required given the following:
Count sub | Function to count sub - arrays whose product is divisible by K.
Calculate the product of the current sub - array.
If product of the current sub - array is divisible by K.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to count sub and the other steps required.
 def countSubarrays ( arr , n , K ) :
	count = 0
	for i in range ( n ) :
		for j in range ( i , n ) :
			product = 1
			for x in range ( i , j + 1 ) :
				product *= arr [ x ]
			if ( product % K == 0 ) :
				count += 1
	return count
if __name__ == " _ _ main _ _ " :
	arr = [ 6 , 2 , 8 ]
	n = len ( arr )
	K = 4
	print ( countSubarrays ( arr , n , K ) )