Function Imports


Not sure that I totally get the whole importing functions thing. What exactly is the syntax for that? So far, I've tried
from module import sqrt
to try to get what you would if you inputted
import math
print math.sqrt(25)
but I don't think that that's right?


math is a module, it has a function called sqrt
you can import sqrt from math or you can import math and access sqrt through that

Both ways will run the entire module that you are importing, the difference is in what/which names are added to your current namespace


I write the codes on the shell script (python 2.7.10).
It runs well. I do not really know why it can not run on the codeacademy.


What makes you say it can't?


it responds IdentationError :unexpected indent(python, line3).


Sounds to me like the code you entered is different from what you entered in idle.

I could sort of imagine that the editor is having a hiccup and that copying the code and pasting it back, perhaps refreshing/resetting the exercise..

I don't know who's fault it is, but Python sure isn't getting the same code as what you entered in idle.


Yep. It runs fine on this emulator:


try this out

from math import sqrt


Fixed finally.
Just execute this : import math
print math.sqrt(13689) :smile:


la mejor opciĆ³n es esta

from math import sqrt
print sqrt(13689)



please help me, I am totally confused:(((

I tried all possible but with no success.

What you have written (code)?


Try this one.

from math import sqrt
print sqrt(25)


just write
from math import sqrt


This what I used:

# Import *just* the sqrt function from math on line 3!

from math import sqrt


For me ( from math import sqrt) worked, but I had space before start of the line 3 and first word 'from'. That was my problem