+ 1
Why should we use the return statement over print() in Python?
4 Respostas
+ 4
Philosophical Coder adding to what Abhay has explained, If you use print in a function, it will output the extra "None" causing the program to behave in an undesirable way
+ 2
return is used to return the value back to function call unlike print that prints the value assigned to a variable or value returned by function call .
Basically if you wanna use the value from a function at various places , just return the value and assign the function call to a variable .
+ 2
But you can use the print as well. If you are using print you don't need to print the function. You can just call it . And then you will get the result you want. Please check this code for better understand .
https://code.sololearn.com/cdJ7B0zYZ6Iz/?ref=app
+ 1
As CHANDAN ROY said ,but only if you print the function call , simply calling function will work fine.