human
Count numbers from a given range whose product of digits is K | Function to find the product of digits of a number.
Stores product of digits of N.
Update res.
Update N.
Function to count numbers in the range [ 0 , X ] whose product of digit is K.
Stores count of numbers in the range [ L , R ] whose product of digit is K.
Iterate over the range [ L , R ].
If product of digits of i equal to K.
Update cnt.
Driver Code"
How can the above be solved in Python?
 ... What is a code to count numbers from a given range whose product of digits is K and the other steps required?
assistant
#Here is code to count numbers from a given range whose product of digits is K and the other steps required.
 def prodOfDigit ( N ) :
	res = 1
	while ( N ) :
		res = res * ( N % 10 )
		N //= 10
	return res
def cntNumRange ( L , R , K ) :
	cnt = 0
	for i in range ( L , R + 1 ) :
		if ( prodOfDigit ( i ) == K ) :
			cnt += 1
	return cnt
if __name__ == ' _ _ main _ _ ' :
	L , R , K = 20 , 10000 , 14
	print ( cntNumRange ( L , R , K ) )