human
Efficient Program to Compute Sum of Series 1 / 1 ! + 1 / 2 ! + 1 / 3 ! + 1 / 4 ! + . . + 1 / n ! | Function to return value of 1 / 1 ! + 1 / 2 ! + . . + 1 / n !.
Update factorial.
Update series sum.
Driver program to test above functions"
How can the above be solved in Python?
 ... Write me a code to efficient Program to Compute Sum of Series 1 / 1 ! + 1 / 2 ! + 1 / 3 ! + 1 / 4 ! +?
assistant
#Here is code to efficient Program to Compute Sum of Series 1 / 1 ! + 1 / 2 ! + 1 / 3 ! + 1 / 4 ! + .
 def sum ( n ) :
	sum = 0
	fact = 1
	for i in range ( 1 , n + 1 ) :
		fact *= i
		sum += 1.0 / fact
	print ( sum )
n = 5
sum ( n )