I cant seem to understand that why wont the function one_good_turn (which i later called ) print something


def one_good_turn(n):
return n + 1
result = n + 1
print “The value of n is %d” (result)

def deserves_another(n):
return one_good_turn(n)



By default, a function returns None at the end of the function. If we want to return something else at the end of the function, we can use the return keyword.

Given return is the last thing a function does, when a return keyword is reached, the function ends

so code after a return will never execute, some editors warn for this. So you would have to move the print statements if you want to see the print statements in action


So do i have to move the print function before the return function??? BTW thanks so much


Did you try this before asking this question? Ideally, you should.

neither return or print are functions or function calls in python2, they are statements.


I am learning py3 also so thats why but can u give me the solution to printing the string plz


i explained why it wasn’t working, then you asked a question which seem to indicate you understood the problem, now you just need to apply the fix?


Hey i tried wot u said but it wont print ? wot should i do?


place the return keyword at the end of your function


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.