Calculate Pi to N Digits

π (Pi)

Pi is an important number in mathematics and engineering. It is an irrational number, meaning that it cannot be expressed exactly as a ratio of two integers.

You can find many Python programs on the web that calculate Pi to N places. Click HERE to go to one of them.

Project #1

Calculate Pi to N places and display it. Display Pi to 6, 10, 20, 50, 100 places.

Hint:

  1. find a Python program on the web you like
  2. copy it to your computer
  3. modify the program (if necessary)
  4. run the program
    1. ask the user how many digits they want to calculate
    2. calculate Pi and display the results
    3. loop

e

e (Euler's number) is also an important number in mathematics and engineering. It is an irrational number, meaning that it cannot be expressed exactly as a ratio of two integers.

You can find many Python programs on the web that calculate e to N places. Click HERE to go to one of them.

Project #2

Calculate e to N places and display it. Display e to 6, 10, 20, 50, 100 places.

Hint:

  1. find a Python program on the web you like
  2. copy it to your computer
  3. modify the program (if necessary)
  4. run the program
    1. ask the user how many digits they want to calculate
    2. calculate e and display the results
    3. loop

Links

Pi (Wikipedia)

e (mathematical constant) (Wikipedia)