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

Swan The Human
seal-mask
.a{fill-rule:evenodd;}techdegree
Swan The Human
Full Stack JavaScript Techdegree Student 19,338 Points

i dont get what it means by "pass the arguement 3" can anyone elaborate for me.

it says to pass the argument as 3 but i don't know exactly what that means to do. i don't want to just keep guessing randomly until i get it and not understand what i even did. if anyone could help explain this to me and make it more understandable i would appreciate it. Thank you

squaring.py
import math 

def square (number):
    return (number * number)
result 

3 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

What Viraj said is certainly correct.

I agree with you that the wording for the challenge can be slightly confusing, but it is standard Python "programmer speak." And by taking this course you too can become a Pythonista! And learn the secret handshake! (kidding about the secret handshake)

Since you passed part 1, you understood how to write a function. In part 2, they are asking for you to use it. One of the strengths (and weaknesses) of the Code Challenge Engine is that it almost always requires valid Python-- I believe it uses a modified version of the Python unittest framework. So when you just put the variable result on a line without an assignment, this ends being a Python syntax error so the challenge also will fail.

See below (part 2) for an explanation.

Python is a lot of fun, so keep at it and you will succeed!

# square function satisfies part 1
def square(number):
    return number * number

# part 2 asks you to declare a variable result
# and then use square and "pass the argument 3"
result = square(3)
Viraj Deshaval
Viraj Deshaval
4,874 Points

Hi Sean, In your function you are passing arguments as string 'number'. It should be a variable who refer to any integer or floating point number.

What this challenge is asking you to do is 1. create function called square with one parameter int/float value 2. Return the square of the result. So square of number can be performed as below:

a = 3
square = a * a
square
9
3. Refer the code above and create the function.
4. Then call the function by passing argument 3 and assign the returned value to result variable.
Sol Henare
Sol Henare
1,633 Points

Ah thank you for this explanation; first time using the forum and great result! I was proper stuck on this init