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 trialUmoja Phiri
731 PointsHow do I call my call my function
def square(number):
return number * number
result = square("number")
print(result)
2 Answers
Jonathan Grieve
Treehouse Moderator 91,253 PointsInstead of the print() method you just need to call the function by specifying its name, followed by curly braces. Then you pass in the value that the function is expecting.
Remember when you declared the function like this def square(number):
You passed in a variable which you used an argument for the function. number
.
As you see the function returns the result of a calculation. All you have to do is provide the number and that is what happens in a function call.
square(5);
Umoja Phiri
731 PointsPerfect. You're awesome Jonathan