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 trialWilliam Paterson
3,331 PointsCreate a function named square. It should define a single parameter named number. In the body of the function, return
def square(number):
return (5*5)
3 Answers
Steven Parker
231,268 PointsThis code always returns 25 (5*5), but it should return the square of the "number" passed as an argument instead.
Sean Layton
1,722 Pointsdef square(number):
return (number*number)
Filip Grąz
282 PointsHi
I have problem with second task, please tell me what is wrong with my code?
def square(number): value = (number * number) return(value)
result = square(3)
print(result)
Steven Parker
231,268 PointsIt's impossible to be sure with unformatted code, but I'd guess you have an indentation issue.
Also, never post a question as an "answer" to another one — always start a new, fresh question.
And when posting code, be sure to format it using the instructions from the Markdown Cheatsheet found below the "Add an Answer" area Or watch this video.