0
How the variable "func" take the function "square"? Thanks
6 Answers
+ 4
It was passed as parameter in print(test(square,42)).
Is that question because you aren't used to manipulate functions as if they were just another variable, or is it because you aren't used to passing variables with different names than the parameters of the function?
+ 1
Please post the code as well.
0
For example:
def square(x):
return x * x
def test(func,x):
return func(x)
print(test(square,42))
How "func" take the function "square"?
0
I think because i'm not used to passing variables with different names than parameter of the function, when i saw this funcion in the "lesson" I just asked myself the reason.
Thanks for helping me.
0
hi
0
I'm knew here can you help me please