math.sqrt()
Takes the square root (math module).
Syntax
import math math.sqrt(number)
Description
Operations like square root, pi, and rounding up/down are in the math module. You must write import math before using them.
Returns
The square root (float).
Example
Loading editor…
Expected output
12.0 3.1416
When to use?
Geometry, distance (Pythagoras), statistical calculations.
Common mistakes
- ⚠️ Forgetting to write import math: gives a 'math is not defined' error.