Created
June 22, 2017 19:21
-
-
Save m-rtijn/25d90889a9c96571a5bb848a1c119fd4 to your computer and use it in GitHub Desktop.
A Python3 script to approximate the value of the mathematical constant e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from math import factorial | |
accuracy = input("Accuracy (integer value >0):") | |
e = 0 | |
for i in range(int(accuracy)): | |
e = e + 1/factorial(i) | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment