Skip to content

Instantly share code, notes, and snippets.

@m-rtijn
Created June 22, 2017 19:21
Show Gist options
  • Save m-rtijn/25d90889a9c96571a5bb848a1c119fd4 to your computer and use it in GitHub Desktop.
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
#!/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