With print()
you will display to standard output the value of param1
, while with return
you will send param1
to the caller.
The two statements have a very different meaning, and you should not see the same behaviour. Post your whole program and it'll be easier to point out the difference to you.
Edit: as pointed by others, if you are in an interactive python shell you see the same effect (the value is printed), but that happens because the shell evaluates expressions and prints their output.
In this case, a function with a return
statement is evaluated as the parameter of return
itself, so the return value is echoed back. Don't let the interactive shell fool you! :)