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 trialmatthew mahoney
Python Development Techdegree Student 2,536 PointsHey im working on one of the quizzes... what am I doing wrong here?
Great now that you have created your new square method, let's put it to use.
Under the function definition, call your new function and pass it the argument 3.
Since your square function returns a value, create a new variable named result to store the value from the function call.
My answer: def square(number): number * number square(3) result = square print(result)
2 Answers
Peter Vann
36,427 PointsHi Mathew!
A couple issues...
You need to return your result from the function, for starters...
This should work:
def square(number):
return number * number # return here
result = square(3) # call the function with 3 as the parameter and store the result
print(result) # print the result (obviously, LOL!?!)
Will print:
9
I hope that helps.
Stay safe and happy coding!
matthew mahoney
Python Development Techdegree Student 2,536 PointsThanks, soo much! This really helps