Last answered:

11 Jul 2023

Posted on:

09 Jul 2023

0

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)
Instructor
Posted on:

11 Jul 2023

0

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

Submit an answer