Python Exercises: Digits of Pi

Digits of Pi

  • Download a text file of the first million digits of pi.
  • Read the file, and store the digits in a list.
  • Parse the list, and report the number of times each digit appears in the first million digits.  For example, tell us how many 1’s there are, how many 2’s, and so forth.
  • Extensions:
    • Make a histogram of this data, using matplotlib
    • Write a short blog post that describes how you solved this problem.
    • Use a regular expression to pull the digits from the text file.
    • Find out if your birthdate appears anywhere in the digits of pi.

About ehmatthes

Teacher, hacker, new dad, outdoor guy
This entry was posted in programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s