Printing out a list item by item in a function


#1



WHat am i supposed to be doing here?


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


#2

Hi @captainmowdy,

This line needs to be indented further, so that it is part of the for loop ...

    print x[i]

Then you need to call the print_list function, passing n to it, as follows ...

print_list(n)

#3

2 posts were split to a new topic: Modifying each element in a list in a function


#4