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 trialMightyIronElf 14
1,798 PointsHow to
After writing my results it keeps telling me my math is wrong and I have no idea why.
number = (5)
def square(number):
return number*5
1 Answer
Travis Alstrand
Treehouse Project ReviewerHey there Haley Phares!
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!
MightyIronElf 14
1,798 PointsMightyIronElf 14
1,798 PointsThanks for this! It really helped!<3
Travis Alstrand
Treehouse Project ReviewerTravis Alstrand
Treehouse Project ReviewerYou're very welcome!