# Python program to estimate the value of mathematical constant ‘e’ according to the formula 1 + 1/1! + 1/2! +1/3! + 1/4! ….. 1/n!

Here is a code for the python program to estimate the value of the mathematical constant ‘e’ according to the formula 1 + 1/1! + 1/2! +1/3! + 1/4! ….. 1/n!

First, we will define a function for factorial.

Then there is the code to estimate the value of e.

```#Python program to estimate the value of mathematical constant ‘e’ according to the formula 1 + 1/1! + 1/2! +1/3! + 1/4! .....

def factorial(factorial_user_input):
fact = 1
while 1 <= factorial_user_input:
fact *= factorial_user_input
factorial_user_input -= 1
return fact

user_input = int(input('Enter the n term in 1/n!: '))
e = 0
f = 0
while user_input > 0:
e = e + ( 1 / factorial(f))
f = f + 1
user_input = user_input - 1
print(e)

# This code is contributed by Ahmad Shafiq

```

## Love this read? Subscribe to Modernage!

Do you have any queries? You can ask in the comments. We, at Modernage answer each and every question, asked in the comments, so If you have any queries, or you want to know about any specific platform you can ask in the comments below

## Author

### This Post Has 7 Comments

1. Abdiel Patton

2. Tiffany Gardner

3. Leif Barker

4. Ellis Magana

5. Brandon Howell

6. Lara Moses

7. brelynn chambi

## More Articles.

### What is Blockchain: A beginners guide to blockchain

With the technology evolving more than ever, we have entered a phase where you will have full control over your data and you can choose

### Python program that reads three nonzero integer values and determines and prints whether they could represent the sides of a triangle.

Here is code for a python program that reads three nonzero integer values and determines and prints whether they could represent the sides of a

### Online Shopping in Pakistan: Ultimate Guide (Jan. 2022)

The concept of online shopping has revolutionized the way how market trades and shopping were happened before. Around 2.14 Billion humans on the earth will

## More Articles.

### What is Blockchain: A beginners guide to blockchain

With the technology evolving more than ever, we have

Continue Reading...

### What is Selfie Art World? Best place to visit in Pakistan

Art represents the cultural heritage of a society. It

Continue Reading...

### Online Shopping in Pakistan: Ultimate Guide (Jan. 2022)

The concept of online shopping has revolutionized the way

Continue Reading...