Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

How do you write square root symbol in Python or even 4 'square root symbol' number?

OpenStudy (e.mccormick):

In ascii, it is character 251.

OpenStudy (e.mccormick):

But that is above 127.... so extended which never got standardized. So I did a little looking. Unicode characters. >>> print unichr(0x221A) √ >>> print unichr(0x221B) ∛ >>> print unichr(0x221C) ∜ >>> Did that on Python 2.7.2

OpenStudy (anonymous):

Hi. As far as I understand, you don't really need the root symbol in Python to calculate root. The easiest way to do it is to use expanentiation symbol **. So, in order to calculate squre root, you just type 16**0.5. As to 4 root, use the same principle. 0.5 is actually 1/2. So you will need 1/4 for 4 root. But take care. You can only get a float as a result of division in Python, if you use floats, not integers. Does it make sense?

OpenStudy (e.mccormick):

I thought they meant for output because many problem sets have you find a way to get the root without using the command. However, that is a good point, they may be trying to actually get a root.

OpenStudy (anonymous):

You can also use "import math" command, then use math.sqrt(x). This figures out the square for you without the use of exponents. As for the 4th root I used the math.sqrt(x) function and applied the usage of exponents in order to get what I was looking for. For example: >>>import math >>>answer = math.sqrt(81)**0.5 >>>print answer 3.0 >>> I'm a total n00b, and I'm a little reluctant to say I could be wrong, but I got the right answer.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!