13 Answers
New Answerbanoo , as you can see, it is always a good idea to prepare a question for q&a well. Provide the complete code, not only one line. Also read the error message carefully, it indicates the line number where the problem occurs. Doing so, saves us a lot of going back and forth and many unnecessary enquiries. Thanks!
😁 how did you imported? from math import pow this will give an error math not defined: print(math.pow(2,3)) this will not: print(pow(2,3)) if you wanna use with main module name like: module.function() Just: import module
banoo, no there's no need. Math should be a pre-installed module for python 3.x. Check your python module index to see if math is included
Hey, banoo. What version of python do you use? Also, there's actually no need to import pow. You can just use pow() directly in python.
If you are doing it in SOLOLEARN, it will give an error , because math module is not imported . When you try in your PC , again it gives same , that means you have to install the library in to your machine. So rectify it.
If you are using an IDE then probably you have to install math first. Just go to pip and write pip install math.
To use pow(power or exponentiation) you dont need to import anything ! Simply write :- print(pow(num1 , num2))
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message