1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Python

Connected

Exercise

Import package

Let's say you wanted to calculate the circumference and area of a circle. Here's what those formulas look like:

$$C = 2 \pi r$$ $$A = \pi r^2 $$

Rather than typing the number for pi, you can use the math package that contains the number

For reference, ** is the symbol for exponentiation. For example 3**4 is 3 to the power of 4 and will give 81.

Instructions

100 XP
  • Import the math package.
  • Use math.pi to calculate the circumference of the circle and store it in C.
  • Use math.pi to calculate the area of the circle and store it in A.