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


#1

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.


#2

@bigcave

Imagine i have a function

def random_function(argument):
    #some code
    pass

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

#3

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

square(10)

#4

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


#5

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 ???


#6

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