human
Check if the product of every contiguous subsequence is different or not in a number | Function that returns true if the product of every digit of a contiguous subsequence is distinct.
To store the given number as a string.
Append all the digits starting from the end.
Reverse the string to get the original number.
Store size of the string.
Set to store product of each contiguous subsequence.
Find product of every contiguous subsequence.
If current product already exists in the set.
Driver code"
How can the above be solved in Python?
 Can you provide a code to check if the product of every contiguous subsequence is different or not in a number and the other steps required?
assistant
#Here is code to check if the product of every contiguous subsequence is different or not in a number and the other steps required.
 def productsDistinct ( N ) :
	s = " "
	while ( N ) :
		s += chr ( N % 10 + ord ( '0' ) )
		N //= 10
	s = s [ : : - 1 ]
	sz = len ( s )
	se = [ ]
	for i in range ( sz ) :
		product = 1
		for j in range ( i , sz , 1 ) :
			product *= ord ( s [ j ] ) - ord ( '0' )
			for p in range ( len ( se ) ) :
				if se [ p ] == product :
					return False
				else :
					se . append ( product )
	return True
if __name__ == ' _ _ main _ _ ' :
	N = 2345
	if ( productsDistinct ( N ) ) :
		print ( " Yes " )
	else :
		print ( " No " )