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

create a function named square It should define a single parameter named number. In the body of the function, return..

...the square of the val that was passed in.

squaring.py

7 Answers

def square(number): return number ** 2

So that did work, but why on this particular code was not second line needed.?

def square(number): value = number * number return value

def square(number): squaren = number * number return (squaren)

Sorry this was the question.. I guess I posted it wrong.

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)*

This is my code: def suqare(number): value = number * number

diogorferreira
diogorferreira
19,363 Points

It might be just me but there is nothing in the question?

please, which second line you are talking about?

Richard Thomas
Richard Thomas
3,029 Points

0/10 task for teaching

def square (number) return number **2

any luck for this quiz yet?