Predict the output of desreves_another(0)


#1

NEED HELP:
PLEASE CORRECT CODE SO THAT DESERVES_ANOTHER(0) RETURNS 3;
def one_good_turn(n):
return n+1
z=one_good_turn(0)
def deserves_another(z):
n= z+ 2
return n;
EXERCISE: FUNCTIONS CALLING FUNCTIONS


#2

What lesson is that? Which module does it belong to?
Also post what you ask in the lesson so that I can understand you better.


#3

it belongs to functions


#4

Your code should be in that order.

def one_good_turn(n):
    return
    
def deserves_another(n):
    return

Obs: That's the order of my code only, no answer, of course!


#5

but the code must return 4


#6

Yes ... I did not say the return is zero and yes, that is the basis of the code for you to assemble your answer.
Anyway ...

Given the basis of how you should assemble your code:
The first return must add the argument plus 1, that is, "n + 1" (without quotes!), And consequently, the second return must add the plus 3 argument.

I hope I was helpfull.


#7

thanks pal i solved it


#8

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