+ 1
I created a function to test when I print something and when I returned.. the same results were obtained.
Check this code out: https://code.sololearn.com/ca9VSIAwtGsH/?ref=app What's the main difference between them?
3 Answers
+ 5
It is generally preferred to return the result insted of printing it inside the function, because it is not necessary that you would be printing the result everytime you call a function.
+ 3
Yes.
+ 1
Does It mean that instead of printing the result inside the function every time we call it we can return the result that we want to print and just print it when needed.