# your code goes here
def calculate(m,n):
result = m * n
return result
print result
calculate(2,3)
This is python code and there is proper indentation in it ,as have tried to put it here also but editor is not supporting .Any way it is running successfully over my editor but it is not printing anything?Any help
Thanks for replying it works out.Its general question not specific to python
Tell me one thing that if we use return before print how it is actually influencing code.
Inside a function, the return keyword tells the function, “I am done - return to the code/function you were executing before you started executing me.” This effectively terminates the function wherever the return statement is. Nothing else in the function will execute after that statement.
Additionally, the return statement can specify a value to pass back to the calling function. In the case with your code, the value being returned was whatever was stored in the result variable.
I can’t tell because of the lack of indentation in the forum post, but the issue is that you were trying to print result from outside the function or you were trying to print result inside the function but after the return statement, so that line would never run.
Instead, you need to print from within the function, prior to return. Or print the result returned from the function, which is what I suggested.