1. 学习
  2. /
  3. 课程
  4. /
  5. Introduction to Python

Connected

练习

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.

说明

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.