human
Count number of triplets with product equal to given number | Method to count such triplets.
Consider all triplets and count if their product is equal to m.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to count number of triplets with product equal to given number and the other steps required.
 def countTriplets ( arr , n , m ) :
	count = 0
	for i in range ( n - 2 ) :
		for j in range ( i + 1 , n - 1 ) :
			for k in range ( j + 1 , n ) :
				if ( arr [ i ] * arr [ j ] * arr [ k ] == m ) :
					count += 1
	return count
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 4 , 6 , 2 , 3 , 8 ]
	m = 24
	print ( countTriplets ( arr , len ( arr ) , m ) )