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

i am failing to pass through this one

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.

(A square is the value multiplied by itself. eg: The square of 5 is 25. 25 = 5 x 5)

squaring.py
def square(number):
    value=5*5
    return value

Yep , i`m failing as well over and over again

7 Answers

Brandon Oakes
seal-mask
.a{fill-rule:evenodd;}techdegree
Brandon Oakes
Python Web Development Techdegree Student 11,501 Points

You need to put number in the place where you have 5. The ultimate goal of the function is to take an argument(number) and times it by itself to get its square. Number just represents different possible numbers that could be placed in the function. Hope this helps.

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

Antonio Falcetta
Antonio Falcetta
14,192 Points
def square(number):
    return number * number
cosmas mwirigi
cosmas mwirigi
1,381 Points

try this:

def square(number): answer = number * number return answer square(5) print(square)

def square(number): value=number**2 return(value) this would do it

thank you Oakes was off the treehouse for a while

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

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

make sure to indent*