Functions: Lesson 18- Answers?


Hi, I am having a bit of trouble with this lesson-


Import the math module in whatever way you prefer. Call its sqrt function on the number 13689 and print that value to the console.

My Work:

from math import sqrt
print math.sqrt(13689):

However, when I press "submit", this pops up:

Did you remember to import the math module? Check the Hint if you need help!

What am I doing wrong?


Instructions: You have to import the math module
What you are doing: Importing only the method sqrt from math module.



Did you mean similar to above, or is there another step I am missing? The results are the same if I use > import math.


I just ran the expected code:

import math
print math.sqrt(13689)

on lesson 18 without an error. Could you please confirm that this code errors for you on this exercise before we move forward? Could you please try Ctrl+R to hard reload the webpage and then try again as well.



You have a colon at the end of your second line. You cant have that


from math import sqrt
print math.sqrt(13689)


Thanks both you and @llucasliu

I did end up figuring this out on my own.


This topic is solved.