Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Chris FreemanTreehouse Moderator 67,464 Points
Hey Harjan Anand, task 2 asks you to call your function and create a new variable
results to store the returned value in.
- call a function by adding parens () after the function name. Any arguments are placing inside the parens. So calling
squarewith the argument
3would look like
- create a new variable is to put a name on the left side of the equals sign =, as in
Putting them together stores the results of the function call in the names variable:
results = square(3)
Edit: to define and call a function would look like:
def func(num): return num * num result = func(10)
where the call is not indented. The change in indentation indicates the function definition has ended and code outside of the function is being defined.
Post back if you need more help. Good luck!!!