Skip to content

Instantly share code, notes, and snippets.

@svineet
Created April 16, 2013 11:32
Show Gist options
  • Save svineet/5395252 to your computer and use it in GitHub Desktop.
Save svineet/5395252 to your computer and use it in GitHub Desktop.
Pi calculator. It's accurate for 5 digits after decimal.
def main():
print "Calculating pi. Calm down,bro!"
acc = 0.0
for i in range(1,1000001,4):
acc += 4/float(i)
acc -= 4/float(i+2)
print i
print "The answer is {0} , brother from another mother!".format(acc)
return 0
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment