Skip to content

Instantly share code, notes, and snippets.

@ericjang
Last active August 16, 2016 17:45
Show Gist options
  • Save ericjang/ba22adbd9f13ca1fcfc40ed8c520f566 to your computer and use it in GitHub Desktop.
Save ericjang/ba22adbd9f13ca1fcfc40ed8c520f566 to your computer and use it in GitHub Desktop.
Compute's Pi using Leibniz formula
r = 0.0
for n in range(1000000):
r += (-1.0)**n/(2.0*n+1.0)
print(4*r)
@wandering007
Copy link

Why did I just get the print result 3.14159165359...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment