+ 1

summation n=0 to infinity((x**n)/n!) how to write this solution in python

18th Oct 2016, 3:40 AM
Anju kv
Anju kv - avatar
2 Antworten
+ 4
""" This code finds the summation of series by taking number of terms and value of x as input from the user """ num = int(input('Please enter the number of terms : ')) x = float(input('Please enter the value of x :')) i = 1 j = 1 sum = 0 while i <= num : value = 1 fact = 1 while j <= i : value = value * x # calculates x^n fact = fact * j # calculates n! j += 1 term = result / fact # calculates each term i += 1 sum += term print('The sum of the given series is : ' + str(sum)) #Hope you find it useful
18th Oct 2016, 9:00 AM
Piyush Bhatia
Piyush Bhatia - avatar
+ 1
https://youtu.be/cNze5ZAlp2w SEE C PROGRAM SUMMATION
2nd Aug 2017, 1:30 PM
Jamiul Alam Rejon
Jamiul Alam Rejon - avatar