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 trialChris Couch
Front End Web Development Techdegree Graduate 25,326 Pointsfiguring out how to start this...
Hi, in Python Basics, the problem "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 passed in." I'm having trouble understanding where to begin. I've gone back through the previous video, 'Returning Values', and still seem lost.
What I tried to do was use... "def square(number) : return math.ceil(..."
... and then I completely lose where to go from there. Any help would be appreciated. Thanks!
def square("number")
1 Answer
Ruben Ponce
Full Stack JavaScript Techdegree Student 12,035 PointsIt seems that you tried to make your parameter a string by using quotations around number. What they wanted were an actual number. So a parameter is kind of like a variable that your function will use somewhere inside it to return a value. For example to square the number 5, you would take your function
def square(5) : square = 5*5
return square
. by the same logic, your parameter will be a variable. so
```def square(number): square = number*number
return square```.
Joshua Wilson
1,005 PointsJoshua Wilson
1,005 Pointsthanks a lot that worked perfect. sometimes its so simple I get stuck