educative.io

What is the difference between return and print?

image

What is the difference if I use “print” instead of “return” over here?

Hi Aditya7,
print just shows the human user a string representing what is going on inside the computer. The computer cannot make use of that printing. return is how a function gives back a value. This value is often unseen by the human user, but it can be used by the computer in further functions.
When we call a function, then function returns some value and If you use print instead of return then this only shows the value on console and does not return any value.