Created
February 24, 2012 00:46
-
-
Save saravanareddy/1896353 to your computer and use it in GitHub Desktop.
Python one liner
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
from random import random | |
print "Pi:", sum(1 for i in range(2000000) if (random()**2 + random()**2) < 1)/2000000.0 * 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment