Return Function vs Print Function in Python



What is the difference between Print and Return function?

I understand print function gives the output of whatever we put in the statement. But I am not able to understand the difference in working of these functions.




Return function is used to terminate / come out of a function. Return can also pass on values to the place where it was called.

Print on the other hand, just sends output. It would be used to either provide some information to the end user or to check values of various parameters in between the run statement.


print 1+2

would directly print 3

On the other hand, return can be used inside a function as below:

define sum_numbers(a, b):

c = sum_numbers(1, 2)
print c

Hope this helps


Thanks Kunal. :slight_smile:
This is helpful.