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

MightyIronElf 15
MightyIronElf 15
2,015 Points

How to

After writing my results it keeps telling me my math is wrong and I have no idea why.

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

1 Answer

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Treehouse Project Reviewer

Hey there Haley Phares! :wave:

Technically, since you've defined your number variable as 5 the math is currently correct, but it isn't quite setup to work as the instructions want us to. It wants us to return the number we passed in "squared", which means it's the whatever number we pass in multiplied by itself.

So currently, if we instead defined number as 10, it will get multiplied by 5 and return 50 instead of 10 squared, which is 100.

So we need to make sure it's setup to multiply the passed in number by itself

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

I hope this makes sense!