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

Can`t get through this task. Can someone guide my through this ?

I was doing this code challenge and it appeared that i cant understand and execute it

squaring.py
def square(number):
    return number**2
def square1(3):
    return 3**2
result = square 

2 Answers

Philip Schultz
Philip Schultz
11,437 Points

Hey Hieu, Task 1 of 2 is asking you to create a function named square that contains a single parameter named number. This function should simply return the square of the number given. Like so,

def square(number):
    return number **2

For task 2 of 2, it is asking you to use the function you just made and store the result in a variable named 'result'. Also, it is specifically asking you to put in the argument of '3' to be passed to the function. Like so,

result = square(3)

Let me know if you are having any other questions about the matter and I'll do my best to help.

Thank you very much for your post Philip ??????