Click here to Skip to main content
14,878,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all, I am beginner great if you could help me. I have installed python 3.7 and having issues in importing the math module to run functions like sqrt, etc. Highly appreciate any suggestions. Saba_baba

What I have tried:

>> import math # does not work
>> _import_(math) # does not work either
>> importlib.import(math) # no results here as well
Updated 22-Mar-21 14:57pm
Visweswaran N 16-Oct-19 20:41pm
Did you get any error messages? If yes, post it here so that I could help you to find where exactly the problem is.

In your "What I have tried section" you have imported math library correctly in the first attempt if you didn't see any error message, then I believe you have imported the library as Python won't notify you if you import a library unless you make it to notify you.

Works fine for me:
import math
print (math.sqrt(4))
Saba_baba 17-Oct-19 12:23pm
Thank you! It worked, this is awesome!
OriginalGriff 17-Oct-19 12:33pm
You're welcome!
import math did not work for me,
for me it worked:
from math import *

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900