Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics Functions and Looping Create a Function

Jeremy Millar
PLUS
Jeremy Millar
Courses Plus Student 3,375 Points

Not sure how to go about this. Im trying to return the square root and for some reason i can't access the math library.

So as per the usual with these posts i think i have it right, but i can't import math to do this so i tried to access the math.sqrt directly. Alas I cannot so their must be another way that I'm not aware of to do this simple math problem. Thank you in advance for any replies.

squaring.py
def square(number):
    number = math.sqrt(number)
    return number

2 Answers

Liam McDonnell
PLUS
Liam McDonnell
Courses Plus Student 1,437 Points

Hey, read Steven's answer carefully there and you'll get it. I was a little tired doing this one and was on the same track as you at first. One last hint remember the difference between a number squared and a square root.

Steven Parker
Steven Parker
231,269 Points

The instructions say, "In the body of the function return the square of the value passed in.". You won't need to get the square root of anything for this challenge.

They also give you the hint: "A square is the value multiplied by itself." so you won't need the math library either.