Creating a Function with a Parameter
What is the difference between the two functions below, and which one is more appropriate?
def plus_ten(a):
return a + 10
and
def plus_ten(a):
print (a + 10)
1 answers ( 0 marked as helpful)
Hi Phongrada!
Thanks for reaching out.
The first one is more appropriate because if you want to reuse the function in another function, you should have the return statement. So, using return
makes your functions reusable.
Hope this helps.
Best,
Tsvetelin