Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Created September 23, 2018 15:32
Show Gist options
  • Save md2perpe/f3dd5f244850a80290a7bb569548a5e8 to your computer and use it in GitHub Desktop.
Save md2perpe/f3dd5f244850a80290a7bb569548a5e8 to your computer and use it in GitHub Desktop.
Calculate Euler's number
from math import factorial
e = 0
for k in range(0, 20):
e += 1/factorial(k)
print("k=% 3d: e=%.16f" % (k, e,))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment