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

Cintia Szalai
Cintia Szalai
8,006 Points

Hello! Can someone help me with this, please? I really have no idea what's the issue here. Thx a lot!

So I checked on a couple of websites how to create a function in Python, but I just seem to remain clueless, I have no idea what is wrong with my code. Could somebody please tell me?

Thank you so much. Kira

squaring.py
def square(number):
    return square
print(square)

2 Answers

Tim Rach
seal-mask
.a{fill-rule:evenodd;}techdegree
Tim Rach
Full Stack JavaScript Techdegree Student 25,127 Points

You are returning "square", but "square" is your function name. You need to return the value pasted into the function. Aswell you need to to the math: number * number to get the square. Then you need to create a new variable named result to store the value from the function call.

def square(number):
    return number * number

result = square(3)

Should do the job

Zachary Parke
Zachary Parke
2,796 Points

Thank you so much on this. I was reviewing these videos and got stuck when I had already answered it correctly awhile back.