Print_list(n) instead of print list(n)


No, I don't stuck. I just don't understand something.

I don׳t understand why I have to write print_list(n) instead of print list(n).

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

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


1.) "Define a function called print_list that has one argument called x."

I would assume this is so because the instructions tell you you have to use print_list. Also, your not really printing list(n) your calling print_list with n in the parameters. Maybe it would have been a little clearer if they had not used print in the function name but that is what they decided on.


Thank you!:slight_smile:


No problem! Happy coding! :smiley:


Wow! You respond really fast!


Well when I am on I ain't a super user for nothing :stuck_out_tongue: haha but especially when talking with people about their coding problems and all I feel like I should respond as quick as possible just to be more considerate of their time :sunglasses:


very funny.......... :smile:


So it should not be print print_list? Why it works also with print_list ?! :slight_smile:


Well once again your not printing your calling your function. It just so happens that your calling a function with print in its name. So if you are just glancing at your code it looks like your printing something when your not xD that is why it can get a little confusing and I think using a function name with print in it was a mistake but whatevah :smiley:


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