# 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 One Comment

1. Abdiel Patton ## More Articles.  ### 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  ### Ask the user to print two numbers ‘x’ and ‘y’ then print out the number ‘x’ raised to power ‘y’.

Here is the code:  ### Python program to print star patterns in python

Here is a python program to print different patterns in python. Contents First Pattern Output of first pattern Second Pattern Output of second pattern Third

## Python

### Python program that reads in an integer and determines whether or not it’s a palindrome. ## More Articles.  ### What is Blockchain: A beginners guide to blockchain

With the technology evolving more than ever, we have  ### What is WEB3? Why is it important! (Simply Explained)

Famously known as web 3.0, web3 is an era  