Functions Calling Functions


#1




Oops, try again. It looks like your deserves_another function returns 2 instead of 3 when we call deserves_another( 0 )


Replace this line with your code. 
def one_good_turn(n = 1):
    return n + 1
    
def deserves_another(n = 1):
    return n + 2


#2

i'm stuck for 3 days


#3

The problem is to return a function from another function. In your example, you need to change the return value of deserves_another to one_good_turn(n) + 2 and it should return 3 for the input of 0


#4

@datacoder50384

Your parameter for both of them should only be the variable "n". Also the idea of the exercise was to call the first function in the second like this:

def one_good_turn(n):
    return n + 1
    
def deserves_another(n):
    return one_good_turn(n) + 2

#5

I just did
def one_good_turn(n):
return n + 1

def deserves_another(n):
return n + 2 + 1
and it worked so.....


#6

thanks it worked out for me


#7

Welcome. :slight_smile:


#8

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