November 15th, 2012, 01:21 PM

Calculating a square root using exponentiation (**)
This is really a math question rather than a Python question, and I feel very dense for not being able to figure it out. I'm reading a book on Python and it introduces the math library as a source of useful functions, like sqrt. Then it says, as an aside, "We could have taken the square root using exponentiation **. (Can you see how?)"
Unfortunately, I can't see how. Can anyone help me?
Thanks.
Eric
November 15th, 2012, 01:30 PM

Originally Posted by EJF
Unfortunately, I can't see how. Can anyone help me?
Kinda basic math.
Code:
>>> 256**(1/2)
16.0
>>> import math
>>> math.sqrt(256)
16.0
Comments on this post
My armada: openSUSE 13.2 (home desktop, work desktop), openSUSE 13.1 (home laptop), Debian GNU/Linux 7.7.0 (mini laptop), Ubuntu 14.04 LTS (server), Android 4.2.1 (tablet), Windows 7 Ultimate (testbed)
November 15th, 2012, 02:31 PM

Originally Posted by SuperOscar
Kinda basic math.
Code:
>>> 256**(1/2)
16.0
>>> import math
>>> math.sqrt(256)
16.0
Thanks, SuperOscar. Boy do I feel stupid.
Eric