Functions (Generic Imports)

Hi!

I’ve just started learning Python and I’m unsure how to proceed with the following exercise on Functions(Generic Imports)
I’ve followed the instructions provided but it doesn’t seem to reflect on the console.
I have written the code below, please do let me know where the error is.

# Ask Python to print sqrt(25).
import math.sqrt()
  print math.sqrt(25)

print() is a function and needs parenthesis.

ex:

print("cat")
print(32)

See:
https://docs.python.org/3/library/functions.html#print

Hey
Thanks for responding. I tried it out but for some reason it still doesn’t seem to work- can’t see the answer

# Ask Python to print sqrt(25) 
import math.sqrt(25)
  print (math.sqrt(25))

There is no space between print() and the parens.

print(math.sqrt(25))

Rather than import the entire math library, if you just wanted to import the sqrt function from the math library, you’d write:

from math import sqrt

https://docs.python.org/3/library/math.html

Hi,
For your import statement you only need;
import math

That imports the whole math library. Then you could also use other math functions, such as cos(), log(), etc in a similar way;
math.cos()
math.log()

Hope that helps