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!

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


def square (number): return (number *number) print (square(2)) result=square("number") print(result)

def square (number):
    return (number *number)
print (square(2))
Jason Anders
Jason Anders
Treehouse Moderator 145,855 Points

Moderator Note: Duplicate posts containing identical content have been deleted from the Community. Please refrain from multiple postings with the same content.

It's also a good idea to include a Meaningful title to the post and include a question. Just posting code with no question, reference, or problem stated makes helping troubleshoot quite difficult.

1 Answer

Jason Anders
Jason Anders
Treehouse Moderator 145,855 Points

As I pointed out above, you didn't state what problems you are having, so this is complete a guess on the issues.
Looking at your code, you have what is needed to pass the first task, but you have way more code than what is asked for in the second task. The second task does not ask for a print statement, so both of them should be deleted. You have the variable asked for (result), but the instruction say to assign the resulting function call with an argument of 3 passed in. You are calling the function but passing in the string "number".

Just fix those few things up and you should be good to go.

If this doesn't solve your problem, you'll need to post the question again with your code, but include the issues you feel you are struggling on, so the Community can best assist you.

:) :dizzy: