How is return different than print? other than syntax | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How is return different than print? other than syntax

8th Feb 2016, 5:30 AM
JK SGF
JK SGF - avatar
2 Answers
+ 2
print only gives the user the output. Return makes it a value that the program understand. You would not be able to add numbers to the result of a function if it was a print function. The explanation is more clear here. http://stackoverflow.com/questions/3881434/difference-between-returns-and-printing-in-JUMP_LINK__&&__python__&&__JUMP_LINK
2nd Mar 2016, 3:18 PM
Stephen Lee
Stephen Lee - avatar
- 2
Both do technically the same thing. The only difference being that you can return only one value per function with return whereas you can print anything any number of times with print. I would not recommend writing this answer in a test as this is only for your understanding. Hope this helped.😃
8th Jul 2016, 5:33 PM
Athreyan MKS
Athreyan MKS - avatar