In: Computer Science
Answer:
print, as the name suggests will print the answer/output on the terminal screen or it would be used to check some values of various parameters throughout the program
whereas, return function is used to come out of a function by returning a value from where it was called.Every function will have a return value. If there is no return function then it will return none.
For e.g., in the above program,
def myfun(a,b):
return a*b
myfun(5,2)
This program will not print anything because you are returning the result of the 2 numbers back to the called function directly,i.e., you are not storing the returned value in a variable.When returning a certain variable from a function, we need to have a place to store the returned variable.
So, you could write the third line as v=myfun(5,2).
This will store the returned value in v and then you can print v.
Otherwise you can also print value directly by calling it inside the print function like this:
print(myfun(5,2))