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'm totally lost on what to do here.

squaring.py
def number(square)
retun square x square

1 Answer

Hi Jeremy,

Your logic is spot on, but you have some syntactical issues in your code.

The syntax for defining a function in python is as follows:

def function_name(parameter):
    # the code inside the function
    # must be indented so that python understands
    # it's a part of the function
    return "some value"

You'll need to add a set of colons after your function name. Then you'll need to indent your return statement (also you've left the second "r" out of return).

Finally, x does not mean multiplication in python. There is a specific operator used in python to multiple values, and it is called the multiplication operator. The multiplication operator is the following character: *

So make those changes, and you'll be all set.

I did it and it worked, thanks!