human
Print all numbers up to N having product of digits equal to K | Function to find the product of digits of a number.
Stores the product of digits of a number.
Return the product.
Function to print all numbers upto N having product of digits equal to K.
Stores whether any number satisfying the given conditions exists or not.
Iterate over the range [ 1 , N ].
If product of digits of arr [ i ] is equal to K or not.
Print that number.
If no numbers are found.
Driver Code.
Given value of N & K.
Function call to print all numbers from [ 1 , N ] with product of digits K"
How can the above be solved in Python?

=====
Write me a code to print all numbers up to N having product of digits equal to K and the other steps required?
assistant
#Here is code to print all numbers up to N having product of digits equal to K and the other steps required.
 def productOfDigits ( N ) :
	product = 1 ;
	while ( N != 0 ) :
		product = product * ( N % 10 ) ;
		N = N // 10 ;
	return product ;
def productOfDigitsK ( N , K ) :
	flag = 0 ;
	for i in range ( 1 , N + 1 ) :
		if ( K == productOfDigits ( i ) ) :
			print ( i , end = " ▁ " ) ;
			flag = 1 ;
	if ( flag == 0 ) :
		print ( " - 1" ) ;
if __name__ == " _ _ main _ _ " :
	N = 500 ; K = 10 ;
	productOfDigitsK ( N , K ) ;