human
Efficient Program to Compute Sum of Series 1 / 1 ! + 1 / 2 ! + 1 / 3 ! + 1 / 4 ! + . . + 1 / n ! | Function to find factorial of a number.
A Simple Function to return value of 1 / 1 ! + 1 / 2 ! + . . + 1 / n !.
Driver program to test above functions"
Solution in Python:
assistant
#Here is code to efficient Program to Compute Sum of Series 1 / 1 ! + 1 / 2 ! + 1 / 3 ! + 1 / 4 ! + .
 def factorial ( n ) :
	res = 1
	for i in range ( 2 , n + 1 ) :
		res *= i
	return res
def sum ( n ) :
	s = 0.0
	for i in range ( 1 , n + 1 ) :
		s += 1.0 / factorial ( i )
	print ( s )
n = 5
sum ( n )