126. Python Program to Compute the Given Exponential Series 1 + x + x^2/2! + x^3/3! + x^4/4! + …… x^n/n!
How does this program work?
- This program is used to find the Sum of the given Exponential series 1 + x + x^2/2! + x^3/3! + x^4/4! + …… x^n/n! using Python.
- The integer entered by the user is stored in variable x and n .
- By using the for loop condition we can easily calculate the Exponential series.
Here is the code
x = int(input("Enter the value of x: "))
n = int(input("Enter the value of n: "))
s = 1
nr = 1
for i in range(1,n+1):
nr = ((nr**x)/i)
print(nr)
s+=nr
print("The sum of the series: ", s)