+ 2
Please help me how this output is coming ?
3 Antworten
+ 3
But how is the argument to add function came to 4 ?
+ 2
func = test(4)
a=4
a+=1
a=5
add(4)
5+4=9
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