13 Réponses
+ 11
banoo , 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!
+ 7
😁
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
+ 5
make sure you installed math before you use it
+ 4
Are you running this on SoloLearn or somewhere else?
+ 3
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
+ 2
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.
+ 2
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.
+ 2
You can write
2⁴ as 2**4 in python
+ 1
If you are using an IDE then probably you have to install math first. Just go to pip and write pip install math.
0
Evans Enweremadu python 3.4.3
should I use another version
0
Under help-python docs-modules-math to see if it has pow included
0
To use pow(power or exponentiation) you dont need to import anything !
Simply write :-
print(pow(num1 , num2))