Lesson goal: The number $\pi$

Previous: Using absolute values | Home | Next: Using square roots

As introduced in a previous lesson, programming languages know how to "crunch" quite a bit of mathematics. In this case, let's study now to handle the famous number $\pi$ which is equal to 3.1415... . Here is the symbol to use for $\pi$ in your code:
math.pi
Move the mouse over a dotted box for more information.

Notice the pi in the name. The prefix of math. means that pi is included in the "math" library that the computer knows about. This something.something notation is very common in computer programming.

Now you try. See if you can get $\pi$ to display. Try print(math.pi).

Type your code here:


See your results here: