Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 8 Online
OpenStudy (anonymous):

does anyone know the sqrt(16) how it is written in python 3 as it doesn't work. Thanks

OpenStudy (anonymous):

you first have to import the math directory to first it has to be'import math' then you can type math.sqrt(16)

OpenStudy (anonymous):

how can i import it ?

OpenStudy (anonymous):

i did it thanks a lot.

OpenStudy (anonymous):

ya sorry meant to type 'import.math'

OpenStudy (anonymous):

import math x=16 print (math.sqrt(x))

OpenStudy (anonymous):

it's probably in the documentation - if you have the documentation file on your computer, go to the index tab and put sqrt in the keyword box maybe read this too: http://effbot.org/zone/import-confusion.htm

OpenStudy (anonymous):

Thanks a ot. That was really helpful

OpenStudy (anonymous):

lot

OpenStudy (carlsmith):

If you're using it a lot in a script, try from math import sqrt Then you can leave out the module name >>>a = sqrt(9) >>>print a 3 >>>

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!