Functions: Lesson 18- Answers?


#1

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

Instructions:

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?


#2

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


#3

Hi-


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


#4

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.

Thanks!


#5

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


#6

from math import sqrt
print math.sqrt(13689)


#7

Thanks both you and @llucasliu

I did end up figuring this out on my own.


#9

This topic is solved.