Python Python Basics Functions and Looping Create a Function

Carlos Augusto Villegas
Carlos Augusto Villegas
1,650 Points

I think my mistake is defining the parameter? I'm not sure how should be done

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

1 Answer

there shouldn't be space between square and (number), indent your return statement so it is inline with the end of def and the number variable is not necessary since you declared it as a parameter so you code should look like:

def square(number):
    return number*number

or

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