13.02
Completed
Python Imports & the math Module Python Imports & the math Module

Import specific names, compare import styles, and use sqrt(), ceil(), floor(), and pi in practical calculations.

Python Imports & the math Module

Sounds useful?

Jump into the interactive version.

No setup. No account. Just Python.

Interactive Python lesson

Python Imports and the math Module

Python modules let you reuse useful tools without rebuilding them yourself. This Block compares import math with from math import name, showing when the clear math. prefix helps and when importing a specific name keeps the code pleasantly short.

What you will learn:

  • Import individual functions and constants from a module
  • Choose between whole-module and specific-name imports
  • Use sqrt() to calculate square roots
  • Use ceil() and floor() for practical grouping and rounding
  • Work with the pi constant in circle calculations
  • Avoid mixing direct names with the math. prefix incorrectly

By the end, you will be able to pick a readable import style and use a small set of practical math helpers with confidence.

> Start now 114 cards · about 9 min

Ready to practice this in the browser?

> Play now