the difference between return and print
I don't know what is the difference between print and return, and when we should use return, and when to print.
Hello Peter
this is the instructor's answer to your question:
It all depends on the reason you are creating the given loop or function for. If the obtained value can (potentially) be used for further calculations, as is the case with the add_10(m)
function from the video lecture (https://learn.365datascience.com/courses/introduction-to-python/use-conditional-statements-and-functions-together/), then return
does a great job.
Otherwise, if all you want from the given loop/function is that Python displays a certain outcome for you, then print()
is the preferred choice, since it better shows your idea behind creating that loop.
Hope this helps.
Best,
Martin