Help 9 Function import


#1



  1. Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your codethrew the following error: invalid syntax (python, line 3)

  2. File "python", line 3
    from module import function sqrt()
    ^
    SyntaxError: invalid syntax


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

from module import function sqrt


#2

this is the general syntax:

from module import function

now, an example of a module available is math, and one of the function defined in math is sqrt, so how would i import sqrt (function) from math (module)?


#3

from math import sqrt

since math is itself a module and we are importing sqrt function from math


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.