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 trialRodwell Panganai Mazambara
3,780 PointsGot the answer to the question below on the forum but can someone make me understand this function.
Create a function named square. It should define a single parameter named number.
In the body of the function, return the square of the value that was passed in.
(A *square is the value multiplied by itself. eg: The square of 5 is 25. 25 = 5 x 5)*
1 Answer
Josh Keenan
20,315 PointsIt wants a function like this:
def square(number):
return number*number
It wants you to write a function that takes any number, and multiplies it with itself to create its square. What the function is doing, is taking the parameter it is being passed, the number we want to multiply by itself, and then doing just that by returning the number multiplied by itself.