0

dont understand the pythin code

hello, could you please elaborate on the following code? I didn't Understand it. def multiply(x, y): return x * y a = 4 b = 7 operation = multiply print(operation(a, b)) https://code.sololearn.com/338/#py thank you.

28th Oct 2017, 4:46 PM
Dariush Shiri
Dariush Shiri - avatar
6 Respuestas
+ 4
try print(multiply(a,b)) link the code in a comment
28th Oct 2017, 4:45 PM
Manual
Manual - avatar
+ 4
Also multiply and multiply() are different things. I do not think function can be copied by just using the "=" operator
28th Oct 2017, 4:50 PM
Manual
Manual - avatar
+ 3
you're defining a function with two parameters that return the multiplication of (x*y) then you're defining two variables then you passing the location of the the function "multiply" to "operation" so now both have access to the location of that function and can use it . it's like object reference of another object because functions are objects . you are referencing another object . is not so cool ? you can also impad functions inside another functions
28th Oct 2017, 5:04 PM
jay
28th Oct 2017, 4:48 PM
Manual
Manual - avatar
0
so what is your code explaining? I didn't get that!! I shared te link by the way
28th Oct 2017, 4:49 PM
Dariush Shiri
Dariush Shiri - avatar