Not getting how the variables relate to each other


#1

This is a general concept that I don't understand, and it keeps me from being able to answer questions. In the code I get that n is the list and that print_list(n) refers to that list. I do not understand the relationship between the variables n and x. Is x just being used as a stand-in variable within the function?

n = [3, 5, 7]   
def print_list(x):
    for i in range(0, len(x)):
        print x[i]
    

print_list(n)

#2

x is the argument of the function that you defined, print_list, it is a variable that represents the list you want to use with the function. n is a list that can be used in the place of x.


#3

I think I understand. Thanks


#4

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