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

I am having trouble understanding this question, mostly the part where it says "pass it the argument 3"

I'm not sure if "under the function" means inside or after the func ends.

squaring.py
def square(number):
    return (number * number)
result = sqaure
Steven Parker
Steven Parker
231,269 Points

When you call a function, you write its name followed by a pair of parentheses. If you also pass it an argument, you put that argument between the parentheses.

1 Answer

Viraj Deshaval
Viraj Deshaval
4,874 Points

I totally agree with steve. Let me tell you in simple terms. We call a function with or without argument means if function asks for arguments we will pass it to the function it could be either string or it or float or dict or tuple or list anything. See below:

def square(num):
    return num*num

square(10)
square([1, 2, 3])

Only thing you need to remember is that when you call a function with arguments then its arguments should go in '()' and you always call a function outside of the the function or from the one function to another. See below:

def square(num):
    return num*num

def calling():
    result = square(5)
    print(result)

I hope this helps

Ah, ok thank you!