+ 2

Please help me how this output is coming ?

https://code.sololearn.com/cmnaBes3KMXI/?ref=app

10th Oct 2019, 5:48 PM
Krishna
Krishna - avatar
3 Respostas
+ 3
But how is the argument to add function came to 4 ?
10th Oct 2019, 6:13 PM
Krishna
Krishna - avatar
+ 2
func = test(4) a=4 a+=1 a=5 add(4) 5+4=9
10th Oct 2019, 5:52 PM
Prathvi
Prathvi - avatar
0
func = test(4) passed 4 as parameter to "test" function print(func(4)) In "return add" you'll be using 4 in the function, because you used "func(4)". same as "add(4)" then, "b" will be 4 and "a" will be 4 after running the "add" function the output will be: a += 1 # same as a = a + 1 # "a" will be 5 return a + b # Output: 5 + 4 -> 9
12th Oct 2019, 9:43 PM
JLMSC
JLMSC - avatar