Last answered:

11 May 2023

Posted on:

23 Apr 2023

0

w_hours in second def

Hello,

Why you used the w_hours in the second def and return this def with full syntax (wage (w_hours))?

I spent more than 30 minutes here to understand this move, it would very helpful if your share more resources for this 

3 answers ( 0 marked as helpful)
Instructor
Posted on:

25 Apr 2023

0

Hi Turki!
Thanks for reaching out.


In the second function with_bonus() the argument w_hours can be with another name. But the important part is that this argument should be the same as in the inner function. Example:

def with_bonus(worked_h):
   return wage(worked_h) + 50
So, these two arguments are different from the first and the second function. The important part is that the second function and its inner function should have the same argument. The idea of using an inner function is to reuse the calculation of the first function. This is very useful.


Hope this helps.
Best,
Tsvetelin

Posted on:

26 Apr 2023

0

Thanks, 


I got your point, like the below code:


def turki (w_weeks):
return w_weeks * 25
def jana (w_weeksA):
return turki (w_weeksA) + 50
print (turki (8) , jana (8))

Instructor
Posted on:

11 May 2023

0

Hi Turki!
Thanks for reaching out.


Yes, this code is correct. Bravo.


Hope this helps.
Best,
Tsvetelin

Submit an answer