+ 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?

15th Jun 2020, 3:04 PM
The Unknown
The Unknown - avatar
3 Respostas
+ 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.
15th Jun 2020, 3:09 PM
Arsenic
Arsenic - avatar
+ 3
Yes.
15th Jun 2020, 4:38 PM
Arsenic
Arsenic - avatar
+ 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.
15th Jun 2020, 3:25 PM
The Unknown
The Unknown - avatar