Python math module

0 votes
I have been using the built-in functions of Exponentiation and logarithms module in Python. But everytime I get the following error:

NameError: name 'sqrt' is not defined
 

I have tried using math.sqrt(4),sqrt(4) and sqrt(4.0) as substitutes but even these didn't work. Can anyone tell me what is wrong?
Nov 23, 2018 in Python by ana1504.k
• 7,870 points
58 views

1 answer to this question.

0 votes
pow is built into the language but you have to import math first.

Try the following:

import math
math.sqrt(4)
answered Nov 23, 2018 by SDeb
• 13,160 points

Related Questions In Python

0 votes
0 answers

what is the use of python math module?

what are different functions that we can ...READ MORE

Jun 7 in Python by Waseem
• 4,480 points
16 views
+1 vote
3 answers
0 votes
1 answer

How to install Python MySQLdb module using pip?

It's easy to do, but hard to ...READ MORE

answered Aug 20, 2018 in Python by charlie_brown
• 7,720 points
80 views
+3 votes
1 answer

Tensorflow 1.5 ImportError: No module named tensorflow.python.client

I think it's a bug in Tensorflow ...READ MORE

answered Sep 25, 2018 in Python by charlie_brown
• 7,720 points
2,461 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 226 views
0 votes
1 answer

Difference between module and Package in Python

A module is basically a single file ...READ MORE

answered Nov 13, 2018 in Python by SDeb
• 13,160 points
115 views
0 votes
1 answer

Python sort() function arguments

Both sort and sorted have three keyword arguments: cmp, key and reverse. L.sort(cmp=None, key=None, reverse=False) -- ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,160 points
256 views