human
Program to find sum of 1 + x / 2 ! + x ^ 2 / 3 ! + ... + x ^ n / ( n + 1 ) ! | Method to find the factorial of a number.
Method to compute the sum.
Iterate the loop till n and compute the formula.
Driver code.
Get x and n.
Print output"
Solution in Python:
assistant
#Here is code to program to find sum of 1 + x / 2 ! + x ^ 2 / 3 ! + .
 def fact ( n ) :
	if n == 1 :
		return 1
	else :
		return n * fact ( n - 1 )
def sum ( x , n ) :
	total = 1.0
	for i in range ( 1 , n + 1 , 1 ) :
		total = total + ( pow ( x , i ) / fact ( i + 1 ) )
	return total
if __name__ == ' _ _ main _ _ ' :
	x = 5
	n = 4
	print ( " Sum ▁ is : ▁ { 0 : . 4f } " . format ( sum ( x , n ) ) )