human
Check if a given number divides the sum of the factorials of its digits | Function that returns true if n divides the sum of the factorials of its digits.
To store factorials of digits.
To store sum of the factorials of the digits.
Store copy of the given number.
Store sum of the factorials of the digits.
If it is divisible.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to check if a given number divides the sum of the factorials of its digits and the other steps required.
 def isPossible ( n ) :
	fac = [ 0 for i in range ( 10 ) ]
	fac [ 0 ] = 1
	fac [ 1 ] = 1
	for i in range ( 2 , 10 , 1 ) :
		fac [ i ] = fac [ i - 1 ] * i
	sum = 0
	x = n
	while ( x ) :
		sum += fac [ x % 10 ]
		x = int ( x / 10 )
	if ( sum % n == 0 ) :
		return True
	return False
if __name__ == ' _ _ main _ _ ' :
	n = 19
	if ( isPossible ( n ) ) :
		print ( " Yes " )
	else :
		print ( " No " )