---
title: "math.sqrt"
space: "Student Handbook"
url: "https://portal.cs17.org/student-handbook/python-manual/math/sqrt"
updated: "2026-10-05"
---

Returns the square root of a number.

## Synopsis

```python
import math
math.sqrt(number)
```

## Description

`sqrt` lives in the `math` module, so the file needs `import math` before you use it.

## Parameters

| Name | Meaning |
| --- | --- |
| `number` | A number that is zero or more. |

## Return value

A `float`, even for a perfect square.

## Example

```python
import math

print(math.sqrt(16))
print(math.sqrt(2))
```

It prints:

```text
4.0
1.4142135623730951
```

## Common mistake

```python
print(math.sqrt(16))
```

Python stops with:

```text
NameError: name 'math' is not defined. Did you forget to import 'math'
```

The file is missing `import math` at the top.

## See also

[math.floor](/student-handbook/python-manual/math/floor), [math.ceil](/student-handbook/python-manual/math/ceil), [round](/student-handbook/python-manual/built-in-functions/round)

[math.sqrt in the Python documentation](https://docs.python.org/3/library/math.html#math.sqrt)
