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

what is wrong with the code?


Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there, Akiva Grobman! Unfortunately, you haven't yet shown us your code, so we really have no way to help you. Take a look at the Markdown Cheatsheet at the bottom of the "Add an Answer" box for tips on how to post your code here. I look forward to seeing your code! :sparkles:

2 Answers

Philip Schultz
Philip Schultz
11,437 Points

Hey Akiva, This challenge is asking for two parts. The first part (task 1 of 2) Is asking you to make a function called 'square'. This function will have one parameter called 'number', then it will return the square of that number. see code below.

def square(number):
    return number**2 
# NOTE: return number**2 - is how you raise to the power of 2. (if you wanted you could just return number * number)

Task 2 of 2, is asking you to simply call the function and to give it the argument of '3', then store the result in a variable called 'result'.

result = square(3)

thank you so much