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

Ladislav Szep
Ladislav Szep
514 Points

def square(number): return value = (number * number), giving me syntax on '='

def square(number): return value = (number * number) I either don't understand the question or I really don't understand this part help please

squaring.py
def square(number):
    return value = (number * number)

1 Answer

Martynas Matimaitis
Martynas Matimaitis
10,480 Points

Hey,

you can do either this:

def square(number):
    return number * number

or

def square(number):
    value = number * number
    return value

For some reason when you are trying to assign a value to variable in the return statements it doesn't understand which part to return.

Hope that helps and sorry for not having a clearer explanation to why

Ladislav Szep
Ladislav Szep
514 Points

that's all good thanks for the answer helped a lot