1
votes

This function, when printed, outputs 7 but when called, does not output anything. Can someone please explain why this is happening?

`def myfunc(x, y): return (x+y)

myfunc(3,4)

This does not output anything. But if I write print(myfunc(3,4)), the output is 7. How does this work?

1

1 Answers

0
votes

Well it does the computation and returns the value.

But since you do not print it it just stays there. The function executes but it does not print to console. Simple as that