user1126849 - 1 year ago 94

Python Question

Whenever I try to use any of the built-in functions of Python's exponentiation and logarithms module, I get an error like this:

`NameError: name 'sqrt' is not defined`

I have tried using

`math.sqrt(4)`

`sqrt(4)`

`sqrt(4.0)`

`pow`

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

`pow`

is built into the language(not part of the math library). The problem is that you haven't imported math.

Try this:

```
import math
math.sqrt(4)
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**