I have a question with the math.pow() function. I was attempting to take the <i>n</i>th root of a number, and there is no function to take roots other than 'sqrt()'. So I tried to use fractional exponents, since 4^(1/2) is the same as taking the square root of 4. I tested this theory in the interpreter, but this is what happened:
As you can see, the app is telling me that 2^(1/2) and 4^(1/2) are both equal to 1, which is true of neither. My question is, how do I take <i>n</i>th roots of a number?
*sorry for the bad formatting, Im new at this
Ohh darn this is in the wrong place. I just saw the 'Pythonista' category underneath 'Editorial'....anyone know how to move posts?
The problem is that
0because you're dividing two integers, if you use
1.0/2.0instead, you should get the expected result (
1./2is actually enough).