3/19 Feel like i am doing it right. Still wont work


Asks to call the Square function on line 9. I did:
def square(10)
and it stated syntax error. I also tried
def square(10))
kept getting syntax errors.



Imagine i have a function

def random_function(argument):
    #some code

I can call this function like this

random_function(argument) # if i print the results directly in  my method. I just call it like this

but then i want to see the result so i can also pass it as token to the print function

print (random_function(argument)) # if i return the final value in my method then i will have to print the call to see it


def square(10) creates a function, to call simple do:



Wow i'm an idiot.... Should have caught that simple mistake. Thanks!


def square(n):
squared = n**2
print "%d squared is %d." % (n, squared)
return squared ()

square (10)

Result: 10 squared is 100.
Traceback (most recent call last):
File "python", line 9, in
File "python", line 5, in square
TypeError: 'int' object is not callable

now what do i do ???


on line 4 you call a function/object:

return squared ()

you just want to return the number:

return squared

next time, please use format so indent stays intact