14 March 2007 ~ 3 Comments

Happy Pi Day!

Today is 3/14… Pi Day! And in honor of this great day, James Tauber wrote a Python script to generate the hex digits of pi. Nice!

If you are so inclined, Wikipedia has a nice article on the various methods of computing pi. Here’s my favorite method:

#!/usr/bin/env python

from math import pi
print pi

Heh.

3 Responses to “Happy Pi Day!”

  1. Nathan Powell 15 March 2007 at 12:23 pm Permalink

    Liar

    >>> import pi
    Traceback (most recent call last):
    File “”, line 1, in ?
    ImportError: No module named pi

  2. Nathan Powell 15 March 2007 at 12:23 pm Permalink

    Heh, oops, I read this in bloglines which had messed up the formatting

  3. John 15 March 2007 at 5:31 pm Permalink

    Heh.

    You could also do `import math` and then call it as math.pi. :P


Leave a Reply