def addsubtract(a,b):
return a+b
return a-b
why does we cannot have 2 return statement ?
def addsubtract(a,b):
return a+b
return a-b
why does we cannot have 2 return statement ?
Hi @coding123c
Although syntactically correct, this piece of code does not make a whole lot of sense, though: the second return statement will never be executed, as the first return statement will terminate the function and go back to wherever the function was called.
What you can do if you want to return 2 values from a given function is :
you may chance the above code as follow :
def addsubtract(a,b): return a+b, a-b
Hope this might helps 
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.