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

Connected

Exercise

Selective import

General imports, like import math, make all functionality from the math package available to you. However, if you decide to only use a specific part of a package, you can always make your import more selective:

from math import pi

Try the same thing again, but this time only use pi.

Instructions

100 XP
  • Perform a selective import from the math package where you only import the pi function.
  • Use pi to calculate the circumference of the circle and store it in C.
  • Use pi to calculate the area of the circle and store it in A.