15/18 use of n


#1

I don’t understand how n gets used if we never use it in the function. Is there a past lesson I need to go back and brush up on?


#2

If you mean something along the lines of:

n = 5

def add_3(x):
    return x + 3

print add_3(n)  # 8

Then, if you look at the last line, the value that n refers to is passed as an argument to add_3
And, indeed, the function never uses the variable n, but it does use the value that n refers to.


#5

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